C/C++ analysis in SonarLint VS2019 stopped working

Hello everyone,

I have the problem that SonarLint stopped working for me a couple of days ago. After I installed the Plugin it was working great for about a month. But now whenever I save a file which triggers the SonarLint analysis I get the following output:

DEBUG: Setting environment variable 'INCLUDE'. Value: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include;;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\include;;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\VS\include;;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt;;;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\VS\UnitTest\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um;
DEBUG: Executing file C:\USERS\SCHIND_F\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\16.0_F482A06B\EXTENSIONS\QUAFNMBV.PBV\lib\subprocess.exe
  Args: - 
  Working directory: C:\Users\schind_f\AppData\Local\Temp\
  Process id: 20052
Refreshing PCH file for C:\gitrepos\compass\swp.compass\Src\Components\RsDeviceStarter\RsDeviceStarter.cpp. PCH file location: C:\Users\schind_f\AppData\Local\Temp\SLVS\PCH\b95f7b5d-d56e-4082-89a2-bfedb30a7d37.preamble
DEBUG: Process returned exit code 0
Using cached rule settings
Analyzing C:\gitrepos\compass\swp.compass\Src\Components\RsDeviceStarter\RsDeviceStarter.cpp
DEBUG: Setting environment variable 'INCLUDE'. Value: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include;;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\include;;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\VS\include;;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt;;;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\VS\UnitTest\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um;
DEBUG: Executing file C:\USERS\SCHIND_F\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\16.0_F482A06B\EXTENSIONS\QUAFNMBV.PBV\lib\subprocess.exe
  Args: - 
  Working directory: C:\Users\schind_f\AppData\Local\Temp\
  Process id: 16720
[CFamily Analysis] Internal error in the analysis subprocess: Compiler execution failed. Compiler path: \cl.exe.
DEBUG: Process returned exit code 0
Failed to analyze C:\gitrepos\compass\swp.compass\Src\Components\RsDeviceStarter\RsDeviceStarter.cpp: See above for more information.

When I open the same project with Visual Studio 2017 (SonarLint 5.5.0.43817) it also works without Problems.
I already reinstalled SonarLint without any changes.
Also when Install SonarLint version 5.5.0.43817 for VS2019 it works without any problems.

I’m using

  • VS2019 (version 16.4.5)
  • SonarLint Plugin (version 6.1.0.45943)
  • Windows 10

Hi @FelixSchindler - welcome to the community.

Are you using vcxproj files, or CMake? Thanks.

Hi Duncan,
thanks for the fast response.
We use conan and cmake to create vcxproj files.

Hi @FelixSchindler,

From the error log you have posted the compiler path seems to be wrong:

[CFamily Analysis] Internal error in the analysis subprocess: Compiler execution failed. Compiler path: \cl.exe.

With recent changes, to find the compiler executable the ClCompilerPath environment variable is used. Could you please check if this env is set properly for your project? One possibility is that this variable is configured in your environment before launching VisualStudio IDE.

Good morning,
thanks to your hint I think I figured it out.
What we do here is the following.
We create a solution for VS2017 but we open it with VS2019. Which was working fine until my SonarLint extension in VS2019 was updated automatically. When I uninstall the SonarLint extension in VS2019 and install the old version (5.5.0.43817) it is working fine again.

I guess I’ll stick to the older version of the extension until we actually start building for VS2019.

Thank you for the hint.

Thank you Tomasz,
Your suggestion helped me.
I have installed SonarLint 6.4.1.47693 and use it with VS2022.
I added a new variable ClCompilerPath with a value “C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\Hostx64\x64\cl.exe” in the system environment