I am able to use gcov properly (at least I think I am), however in some of my directories, I am not able to output coverage for some of the header files. For example, myfile.cpp shows coverage however myfile.h (or myfile.hpp) doesn't. Any help would be greatly appreciated.
Asked
Active
Viewed 1,755 times
1
-
1Does your header contain function definition? Or just declaration? – Gluttton Jul 20 '16 at 21:26
-
Has several function definitions. I think I figured out part of the problem. Some of the .gcno files weren't getting created. I'd get an error telling me that I reached the unexpected end of file. I went through and removed a .gcno file (and the .gcda file), recompiled, rebuilt, ran lcov, then repeated for each file that had the unexpected end of file. – bsquared82 Jul 20 '16 at 22:04
-
Now my issue is that there's a timestamp mismatch in the .gcda files since I had to recompile the files that had unexpected end of files. My question is, if I have to do this, is there any way to recompile and sync up the .gcda timestamps? – bsquared82 Jul 20 '16 at 22:05
-
Update. I'm also still missing some of the header files. – bsquared82 Jul 20 '16 at 22:10
-
If it helps, I'm running gcc 4.4.7. I've heard there are problems with earlier versions of gcc. – bsquared82 Jul 20 '16 at 22:24
1 Answers
0
The time stamp issue is simply because you're using the same source to create multiple outputs. For example, your makefile makes the debug objects, then makes the optimized objects. Or you use the same source to make static and dynamic libraries. Or perhaps compiles thing.c
to create a .o
to add to your static archive, but also compile thing.c
with -DMAKE_MAIN
to create the test program.
In any case, each time you compile the source, the GCOV Notes files (.gcno
) are replaced, so now when you run the code analysis, the .gcno
is newer than the executable so you get the time stamp error.

Luv2code
- 1,079
- 8
- 14