Getting issue with CPP codecoverage

Hi, Im trying to get the code coverage for c++ code. For this, I’ve created gcov reports and then converted those gcov reports to cobertura.xml using gcovr tool.
When passing the cobertura.xml to sonar scanner command, with community edition i could see some code coverage being reported where as with enterprise edition getting issue as below.

ERROR: Error during SonarScanner execution
The only way to get an accurate analysis of C/C++/Objective-C files is by using the SonarSource build-wrapper and setting the property “” or by using Clang Compilation Database and setting the property “sonar.cfamily.compile-commands”. None of these two options were specified.
If you don’t want to analyze C/C++/Objective-C files, then prevent them from being analysed by setting the following properties: *

Why is this error coming only with enterprise edition? and why is the sonar not able to identify the code with sonar.language property?

Hello @Gopalakrishna and welcome to our community!

Analyzing C++ code is not available in the Community Edition of SonarQube, it starts with the Developer Edition so that is why you have this error with the Enterprise Edition and you don’t have it with Community Edition.

I’m not sure to understand your second question though…


I have used cxx plugin integrated with community edition. I understand that you do not provide any support for this. Can you help us to integrate gcov reports to sonar scanner and get the coverage for c++ code? or tell us the process how C++ code gets scanned and get coverage ?

Hello @Gopalakrishna,

If I understand correctly, you need help to use gcov reports in your Enterprise Edition of SonarQube.

To do so:
The steps to integrate gcov reports are described in this documentation: Test Coverage & Execution.
Basically, you need to fill in the property sonar.cfamily.gcov.reportsPath in your with the path to your *.gcov report (and not cobertura.xml generated by gcovr).
Another solution is to use the property sonar.coverageReportPaths with a coverage report written in the Generic Test Data Format.

To analyze C++ code, you first need to wrap your build with build wrapper before running the sonar-scanner command (see documentation)

Do that answer your questions?