Using /CLR Option in C++ scan

We are purchased SonarQube Developer Edition recently and tried to scan our C++ source code. But it is failing with the error message “WARN: Microsoft extension activated by “/clr:nostdlib” compiler option is not supported, skip analysis of files:”… In the forum it is mentioned that /c/r option is not supported in SonarQube. But in the community edition, we were able to complete the C++ scan without any issues. But it is failing only in the purchased Developer Edition. Is there a way to succeed the scan without removing the /clr option. Because, if we remove the /clr option, the build itself will fail. Can you please check and let me know ?

Hi @gdbkumar,

community edition doesn’t scan C++ code.

This is rather a warning, not a failure.

/clr enables C++/CLI which are not supported by our analyzer. You should restrict /clr option only to the files you really need extension, if you need it at all.

Hi Massimo,

In community Edition, we used the below plugin
C++ (Community)
Enable analysis and reporting on c++ projects. * 1.3.2 (build 1853) installed. Using this plugin we are able to scan the same C++ code with /clr option.

But in the Developer Edition only, we are facing the mentioned issue and the scan is failing.

We are also facing the same problem, which is mentioned in the below link.

(Sonarcloud: Microsoft extension activated by "/clr:nostdlib" compiler option is not supported)

If the latest scanner is not supporting /clr option, which scanner version will support ?
Can you please clarify ?

Hi @gdbkumar,

this plugin is not supported by us and I doubt about the quality of analysis reported on C++/CLI code.

Again, this is C++/CLI.

Our commercial plugin do not support C++/CLI, as easy as that. Please restrict /clr options to the files where you really need it if you need it at all. In any case I would suggest you to not use C++/CLI extensions unless really required.

Hi Massimo,
Some of the projects are used /clr option… Is there any way to exclude the projects which are using /clr option ? If there is any option available, please let me know. We will exclude those projects from the scan.

Hi @gdbkumar,

/clr files are skipped without failing the analysis, this is just a failure.

If ALL files are C++/CLI then the analysis fails because there are no files to analyze.

No. It got failed and the scanning results are not updated for other C# projects.

If I exclude all the CPP and h files, then other C# projects are scanned and the scan result is displayed.
So, I want to skip only the projects which are using /clr option…

My question here is :slight_smile:
Is there any way to exclude the projects which are using /clr option ? If there is any option available, please let me know. We will exclude those projects from the scan.

Hi @gdbkumar,

No, there is no way.

Scanning is working by excluding the /clr project in Coverage Exclusions and Source File Exclusions under Project Settings->General Settings.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.