Meine Quelle und bauen Baum sieht wie folgt aus (Makefile to put object files from source files different directories into a single, separate directory? sehen) nach einem Make (die baut und betreibt FooAndBarTests):Wie kann ich lcov mitteilen, wo meine .cpp- und .h-Dateien zu finden sind?
src
- Foo.cpp
- Bar.cpp
inc
- Foo.h
- Bar.h
test
- FooTest.cpp
- BarTest.cpp
- Main.cpp
- Makefile
- obj
- Foo.gcda
- Foo.gcno
- Bar.gcda
- Bar.gcno
- FooAndBarTests
UnitTest++
- libUnitTest++.a
- src
- ...
ich dann .gcov Dateien im Verzeichnis test gcov -o obj/ ../src/Foo.cpp
und gcov -o obj/ ../src/Bar.cpp
, indem Sie produzieren kann.
Aber wenn ich lcov -d obj/ -c -o FooAndBarTests.lcov
laufen erhalte ich:
Capturing coverage data from obj/
Found gcov version: 4.2.1
Scanning obj/ for .gcda files ...
Found 4 data files in obj/
Processing Foo.gcda
../src/Foo.cpp:cannot open source file
Processing FooTest.gcda
FooTest.cpp:cannot open source file
../inc/Foo.h:cannot open source file
../UnitTest++/src/Checks.h:cannot open source file
...
Und dann, wenn ich genhtml FooAndBarTests.lcov
laufen erhalte ich:
Reading data file FooAndBarTests.lcov
Found 45 entries.
Found common filename prefix "/Users/dspitzer/FooAndBar/test"
Writing .css and .png files.
Generating output.
Processing file UnitTest++/src/Checks.h
genhtml: ERROR: cannot open /Users/dspitzer/FooAndBar/test/UnitTest++/src/Checks.h for reading!
Wie kann ich feststellen lcov und GenHTML wo die CPP und H-Dateien sind?
Ich weiß es nicht genau, aber versuchen Sie es mit der Option -g beim Kompilieren. Es fügt Metadaten zum Debuggen hinzu (einschließlich Dateipfade und Zeilennummern, denke ich). – sellibitze
Ich verwende bereits die Option -g beim Kompilieren. –