C/C++ Code Analysis using SonarLint in Visual Studio

Hi,

I would like to analyse C/C++ code using SonarLint in Visual Studio. I open C/C++ project solution in Solution Explorer and in Team Explorer when i try to connect to SonarQube Server it gives the error: This solution contains no supported project language (C#, VB.Net). Please create at least one project of the supported language and then try to reconnect.

Versions Installed:
Visual Studio 2015
SonarLint 4.6.0.3815

Could anyone please help me to resolve this and perform the analysis successfully using SonarLint?

Thanks,
Madhu

Hi Madhu,

Connected mode works only for C# and VB.NET projects, you cannot use it for the “additional languages”, such as C/C++ and JavaScript. At this time I cannot say when we are going to add this feature, though.

You should be able to analyze C/C++ code with SonarLint for VS, but only using the rules that are enabled by default.

Kind regards,
Valeri

Hi Valery,

Thank you for the response.

I opened my C/C++ solution in VS 2015 (It has 3 Projects). For each project i have enabled “Enable Code Analysis on Build” in Properties --> Code Analysis section and Projects are using “Microsoft Native Recommended Rules” rule set.

The build is successful. The outputs of SonarLint and Error List for the opened project files look like below:

Show output from: SonarLint

Error List:

Could you please guide me with the right way of analysis?

Thanks,
Madhu

Hello Madhuvanthi,

I had similar issues with SonarLint 4.6, but they were corrected in the latest version (which is 4.7). Maybe you should give it a try…

Hello,

I tried with SonarLint 4.7.0.3891 as well. I have same issues.

Regards,
Madhu

Hello Madhuvanthi,

I did not see in your previous screenshot, but your project uses a PlatformToolset that is not a default Visual Studio one (gcc_arm_...). This toolset is not supported by SonarLint for VisualStudio…

Regards,
Loïc