This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: undefined reference to _gcov_init


Qiong Cai wrote:

I compiled some program with -fprofile-arcs, but it
failed when linking the object files together:
% make
/import/qin/1/qiongc/gcc-3-4-cvs/bin/gcc -O2 -fprofile-arcs -I/import/qin/1/qiongc/gcc-3-4-cvs/include -I../utils -c LUFactSizeA.c /import/qin/1/qiongc/gcc-3-4-cvs/bin/gcc -O2 -fprofile-arcs -I/import/qin/1/qiongc/gcc-3-4-cvs/include -I../utils -c LUFact.c /import/qin/1/qiongc/gcc-3-4-cvs/bin/gcc -o LUFactBenchSizeA LUFactSizeA.o LUFact.o -L/import/qin/1/qiongc/gcc-3-4-cvs/lib -lm -L../utils -lgetclock LUFactSizeA.o(.text+0x5e): In function `_GLOBAL__I_main_GCOV':
: undefined reference to `__gcov_init'
LUFact.o(.text+0x197e): In function `_GLOBAL__I_datasizes_GCOV':
: undefined reference to `__gcov_init'
../utils/libgetclock.a(getclock.o)(.text+0x6d): In function `_GLOBAL__I_getclock_GCOV':
: undefined reference to `__gcov_init'
../utils/libgetclock.a(gtod.o)(.text+0xb0): In function `_GLOBAL__I_starttime_GCOV':
: undefined reference to `__gcov_init'
collect2: ld returned 1 exit status

On the link line you have to either a) add -fprofile-arcs b) add -lgcov

I see the manual is not clear on this, I'll fix that.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan at codesourcery dot com : http://www.cs.bris.ac.uk/~nathan/ : nathan at acm dot org



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]