Search code examples
windowseclipse-cdtgcoveclipse-neon

Eclipse fails to call gcov and evaluate result


I have a C Project with its own independent make chain (aka external build) Platform is Windows 7 with eclipse neon 3.

For that project i have included GTest and for each source file a corresponding Gtest_UnitTest.cc. UnitTest comes with its own extra make chain. UnitTest and all works like a charm.

Now i want to include a coverage Report. I added -ftest-coverage -fprofile-arcs to the compiler flags and -lgcov to the linke. For each *.o compiled i get a *.gcno. After running the build exe i get for each *.o a *.gcda. I also get a nice gcov report inside of eclipse.

So far so good!

What does not work is code highlight. And eclipse fails to call gcov for accumulating all the gcda and gcno. (Is there somewhere a debug console where such calls can be read?) If i try to open a *.gcda or *.gcno in eclipse, eclipse asks me about the binary the report was created with. outputfolder

When i specify my executable, i get an error, its not an ELF file. -_- Is eclipse a bit picky and wants a linux *.out file? when i invoke gcov manually via commandline i get for each *.o a *.gcov result file. But i couldn't manage to convince eclipse to use that in any way to highlight (un)covered code lines... I tried to copy some of the resulting *gcov files to the same folder as the *.c file is. No magic happend...

Maybe its a result of my external build (i will copy the project and try a internal build later on)

Maybe its a result of distribution of the source files as follows: distribution of the source files Maybe its a bug in eclipse as i read something about it, but most bugs are from the time of eclipse luna... cant imagine they are still unfixed...

What am i doing wrong?

I have read about lcov for linux, but my searches turned up no easy solution for windows... Is there any solution for my use case?

Or is the final solution to move on and get visual studio?

Related to: Eclipse gcov missing highlighting in code No source code coverage color highlighting in eclipse-cpp-luna-SR1 for static library project


Solution

  • I have an update on this:

    The solution in the end was very trivial, add c/c++ autotools to the project. In the Navigator, right click on the top node of the project -> New -> convert to Autotools.

    After that, one needs to redefine the build options. (In my case a external build chain is used. With the conversion the existing build setup may be lost.) convert to autotools project

    After conversion also the build tree should show up. Build the project one time so the unittest.exe is created and configure the Profile Configurations Profile Configuration

    The Result after profiling should look like this: coverage result