0

How to generate and view code coverage using Qt Creator with MinGW on Windows?

I'm already able to generate it using GCOV and LCOV on OS X with the following flags in my .pro file:

mac {
    QMAKE_CXXFLAGS += --coverage
    QMAKE_LFLAGS += --coverage
}

I have accomplished that by following this tutorial.

What tools/flags should I use to generate and view the code coverage on Windows?

Note: on OS X I'm using Clang.


Update:

I have successfully generated the GCNO and GCDA files, but I don't know how can I access/visualize the code coverage properly.

As far as I know, LCOV doesn't work on Windows.

I found the Ported to Windows LCOV Code Coverage tool project on Github and I will try to use it.

Some related questions:

Qt and gcov, coverage files are not generated

Can GCov be used in windows?

Is there any actively supported lcov port for windows

KelvinS
  • 2,870
  • 8
  • 34
  • 67
  • You added this to the `mac` section, yet you're running Windows. Why? – MrEricSir Nov 08 '17 at 16:35
  • @MrEricSir actually the application is multi platform so I would need to generate the code coverage on both Windows and OS X. Until now I have only followed the tutorial mentioned (for OS X). As I explained, I read that the GCOV doesn't work with MinGW, but I have not tried it yet. – KelvinS Nov 08 '17 at 17:09

1 Answers1

0

For this platform case your .pro file should contain:

win32 {
  # MinGW-related settings
}
Alexander V
  • 8,351
  • 4
  • 38
  • 47