I am compiling all my .cpp
with -g --coverage
and linking with --coverage
When I run my executable, the .gcda
file is produced.
But when I do gcov file_test.cpp
it says:
$ gcov file_test.cpp
file_test.gcno:cannot open notes file
file_test.gcda:cannot open data file, assuming not executed
No executable lines
But the directory contains all the required files
$ ls
file_test.cpp file_test.cpp.gcda file_test.cpp.gcno file_test.cpp.o
If you look at the gcov
error, it looks like it's chopping off the .cpp
from the filename.
What is happening?
If it's relevant, I'm using cmake
and the .gcda
, .gcno
files are produced next to the .o
file which is in cmake
's nested folder structure so I have to copy file_test.cpp
to that folder and run gcov
.