help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: G++ -pg no gmon.out


From: abba
Subject: Re: G++ -pg no gmon.out
Date: Thu, 16 Apr 2009 04:41:10 -0700 (PDT)
User-agent: G2/1.0

On Apr 16, 7:10 am, abba <chad.stev...@gmail.com> wrote:
> I am just trying to run a simple program right now to get profiling to
> work before I move on to my larger program. Currenlty the code is very
> simple:
>
> #include <iostream>
>
> int main (int argc, char*argv[])
> {
>    int b = 0;
>    for(int i = 0; i < 10000000; i++)
>    {
>       b++;
>    }
>  std::cout << b;
>
> }
>
> As you can see it is very basic and I named the file main.cpp. When I
> compile I get a warning when I  run the line:
>
> > g++ -g -pg main.cpp
>
> I get the warning:
> consider linking with '-static' as system libraries with profiling
> support are only provided in archive format
>
> I get an a.out file, but when running the a.out I don't get a
> gmon.out. I tried running with the -static in the command line:
>
> >g++ -g -pg -static main.cpp
>
> I don't get the warning and when I run a.out I get the gmon.out file,
> but my larger program can't be run with the static flag. Is there a
> way around this??

I made a mistake...it wont link that static...I had to change it to
stdio.h and use a printf instead of iostream. After changing that I
changed it to static and it worked.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]