help-gplusplus
[Top][All Lists]
Advanced

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

G++ -pg no gmon.out


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

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??


reply via email to

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