This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcov and autotools - filename issues
Oh ok, my bad, now I've figured out how it should work.
> I had a look at the -o option, but I'm not sure how to use it. For example,
> this is the only way I can get gcov to run:
>
> $ gcov tests/tests.cpp -o tests/tests-tests
You have to run gcov in the same directory as the .cpp file, otherwise it
gives an error message about being unable to find it (even with a path.) This
works:
$ cd tests; gcov tests.cpp -o tests-tests
Likewise for other files:
$ cd tests; gcov blah.cpp -o tests-blah
> I'm also a bit confused about why I should supply a .cpp filename instead of a
> program name. How does it know which program to run? If I run "gcov
> string.cpp" how does gcov know that it needs to run some other program with
> certain parameters to actually execute the code in that file?
Now I also realise I'm supposed to run the program normally *first* to
generate the .gcda files, *then* gcov is used to convert them into
human-readable text files with the commands above.
Now it seems to work as advertised :-)
Cheers,
Adam.