阅读量:0
通过快捷方式打开VS Code是编译不了的,需要对tasks.json修改(Tasks: Configure default build task)
先创建tasks.json
复制这段配置到tasks.json,记得修改VsDevCmd.bat的路径
{ "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 (x86)/Microsoft Visual Studio/2019/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 } } ] }
不能通过点击运行来运行,需要当作任务运行