Search code examples
cgccclangcode-coveragegcov

undefined reference to `llvm_gcov_init'


Trying to compile a c project then encountered error like below

undefined reference to `__llvm_profile_instrument_target'
undefined reference to `llvm_gcda_start_file'
undefined reference to `llvm_gcov_init'

Solution

  • This is due to using the wrong compiler! gcov is meants to be built with GCC. Therefore switching the compiler to GCC fixed the build