I have the same problem with this.
When I try to complie, I see the small pop-up message :
cl.exe build and debug is only usable when VS Code is run from the Developer Command Prompt for VS.
With this link, I tried to figure it.
When I typed cl, it shows as it is in the documentation which is correct.
However, I still see the pop-up message above.
I changed the tasks.json as the documentation :
{
"version": "2.0.0",
"windows": {
"options": {
"shell": {
"executable": "cmd.exe",
"args": [
"/C",
// The path to VsDevCmd.bat depends on the version of Visual Studio you have installed.
"\"C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/Tools/VsDevCmd.bat\"",
"&&"
]
}
}
},
"tasks": [
{
"type": "shell",
"label": "cl.exe build active file",
"command": "cl.exe",
"args": [
"/Zi",
"/EHsc",
"/Fe:",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"${file}"
],
"problemMatcher": [
"$msCompile"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
But I still see the same message.
Is there any solutions with this?
(environment variable is also set)
I have already explained the solution to your problem in this question:
setting up MSVC in Visual Studio code [duplicate]
In short, the problem is that your compiler needs to be in your path when launching VS Code.
One posssible way to solve the problem is to open the Developer Command Prompt for VS 2022 and typing in
>code .to open VS Code with the path already set up.