Gcov Error Cannot Open Source File
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn lcov cannot open source file more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags lcov base directory Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you,
How To Use Gcov
helping each other. Join them; it only takes a minute: Sign up How do I tell lcov where to find my .cpp & .h files? up vote 11 down vote favorite 1 My source and build tree
Genhtml
looks like this (see Makefile to put object files from source files different directories into a single, separate directory?) after a make (which builds and runs FooAndBarTests): 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 - ... I can then produce .gcov files in the test directory by man lcov running gcov -o obj/ ../src/Foo.cpp and gcov -o obj/ ../src/Bar.cpp. But if I run lcov -d obj/ -c -o FooAndBarTests.lcov I get: 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 ... And then when I run genhtml FooAndBarTests.lcov I get: 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! How do I tell lcov and genhtml where the .cpp and .h files are? c++ code-coverage gcov lcov unittest++ share|improve this question asked Dec 10 '10 at 19:50 Daryl Spitzer 32.5k54129154 I don't know for sure but try using the -g option when compiling. It adds meta data for debugging purposes (including file paths and line numbers, I think). –sellibitze Dec 10 '10 at 21:34 I am already using the -g option when compiling. –Daryl Spitzer Dec 11 '10 at 0:11 add a comment| 1 Answer 1 active oldest votes up vote 13 down vote accepted Use the -b option to lcov. The -b option specifies code base. share|improve this answer edited Feb 25 '15 at 15:26 fduff 1,88511526 answered
instructions: Windows Mac Red Hat Linux Ubuntu Click URL instructions: Right-click on ad, choose "Copy Link", then paste here → (This may not
Using Lcov
be possible with some types of ads) More information about our gcovr ad policies X You seem to have CSS turned off. Please don't fill out this field. You seem to have CSS turned off. Please don't fill out this field. Briefly describe the problem (required): Upload screenshot of ad (required): Select a file, or drag http://stackoverflow.com/questions/4412709/how-do-i-tell-lcov-where-to-find-my-cpp-h-files & drop file here. ✔ ✘ Please provide the ad click URL, if possible: Home Browse Linux Test Project Mailing Lists Linux Test Project Testsuite to validate the reliability, robustness, stability of Linux. Brought to you by: metan, mreed10, mridge, nstraz, and 6 others Summary Files Reviews Support Wiki Mailing Lists Tickets ▾ Patches Bugs Feature https://sourceforge.net/p/ltp/mailman/message/26180780/ Requests News Git CVS ltp-announce ltp-commits ltp-coverage ltp-cvs ltp-list Re: [Ltp-coverage] lcov problem, cannot open source file Re: [Ltp-coverage] lcov problem, cannot open source file From: Kirti Kenghe (kkenghe)
instructions: Windows Mac Red Hat Linux Ubuntu Click URL instructions: Right-click on ad, choose "Copy Link", then paste here https://sourceforge.net/p/ltp/mailman/message/26472980/ → (This may not be possible with some types of ads) More information about our ad policies X You seem to have CSS turned off. Please don't fill out this field. You seem to have CSS turned off. Please don't fill out this field. Briefly describe the problem (required): Upload screenshot of cannot open ad (required): Select a file, or drag & drop file here. ✔ ✘ Please provide the ad click URL, if possible: Home Browse Linux Test Project Mailing Lists Linux Test Project Testsuite to validate the reliability, robustness, stability of Linux. Brought to you by: metan, mreed10, mridge, nstraz, and 6 others Summary cannot open source Files Reviews Support Wiki Mailing Lists Tickets ▾ Patches Bugs Feature Requests News Git CVS ltp-announce ltp-commits ltp-coverage ltp-cvs ltp-list Re: [Ltp-coverage] A patch for lcov to handle source tree paths Re: [Ltp-coverage] A patch for lcov to handle source tree paths From: Peter Oberparleiter