Hi,
1.Make sure C++ workload is installed.
2.Compiling in the correct Visual Studio Command prompt could fix the detection.
Run the command line through the x64 native tool Command prompt for Visual Studio:
The command line is below the error message you provided. Such as:
Provided 'inheritEnvironments' doesn't provide the necessary environment variables needed to set the context for the configuration x64-Debug. You can work around this by adding the necessary environment variables such as INCLUDE, LIBPATH, PATH and others to an environment block in your CMakeSettings.json.
1> CMake generation started for default configuration: 'x64-Debug'.
Command line: "C:\windows\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug" -
......
In addition, this issue occurs in some versions of Visual Studio 2019. Please consider updating to the latest Visual Studio 2022.
Best regards,
Minxin Yu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.