question on "undefined reference to _gcov_init"

Nathan Sidwell nathan_sidwell@mentor.com
Mon Jan 7 07:57:00 GMT 2013


On 01/06/13 03:00, Gu, Forrest wrote:
> Hi, Nathan,
>
> IÂ’ve seen your message with Qiong Cai on gcov link problem, from a mail of 19
> Apr 2003Â…

gcov has changed a lot since then.

>
> and you suggest to either:
>
> a)add -fprofile-arcs
>
> b)add -lgcov
>
> However, I succeed with a) but fail with b), it prompts:
>
> gcov: invalid option – ‘g’
>
> usage: gcov [OPTION]Â… SOURCE|OBJÂ…
>
> It seems -lgcov is not a valid option for gcov command.

Correct.  -lgcov is an option to the compiler.  IIRC -ftest-coverage 
-fprofile-arcs is the right invokation now.

nathan

-- 
Nathan Sidwell



More information about the Gcc mailing list