Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcc: undefined reference to _mcount (gprof instrumentation)

When compiling my c++ sources with the -pg option to inject gprof profile instrumentation code the compile fails with the undefined reference to _mcount error.

Without this option everything compiles (and runs) fine. What is wrong in my case? (Solaris 10 SPARC Platform)

like image 575
MRalwasser Avatar asked Jan 05 '11 11:01

MRalwasser


1 Answers

Are you both compiling each object file and linking the final executable using the '-pg' flag?

like image 105
trojanfoe Avatar answered Oct 19 '22 20:10

trojanfoe