vscode配置调用visual studio的编译和调试环境

以下展示方法3的配置文件:

//launch.json
{
  // 使用 IntelliSense 了解相关属性。 
  // 悬停以查看现有属性的描述。
  // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "2.0.0",
  "configurations": [
    {
      "name": "cl.exe - 生成和调试活动文件",
      "type": "cppvsdbg",
      "request": "launch",
      "program": "${workspaceFolder}/${fileBasenameNoExtension}.exe",
      "args": [
      ],
      "stopAtEntry": false,
      "cwd": "${fileDirname}",
      "logging": {
        "moduleLoad": false,
        "trace": true
      },
      // "showDisplayString": true,
      // "visualizerFile": "${workspaceRoot}/my.natvis",
      // 使用.nativs处理显示数据,参考:
      // https://docs.microsoft.com/visualstudio/debugger/create-custom-views-of-native-objects
      // http://t.zoukankan.com/yilang-p-12432873.html
      // "requireExactSource": true,
      "console": "integratedTerminal", //使用内置终端
      //"console": "externalTerminal",
      "preLaunchTask": "cl.exe build active file",
      "postDebugTask": "delete extra files"
    }
  ]
}
//CleanRubbish.bat
@echo off
set path=%fileDirname%
for /r %path% %%s in (*.exe *.ilK *.obj *.pdb) do (
    del /f /s /q "%%s"
)

8.未能完美解决的是VS的有些代码格式在编辑阶段会提示错误,但实际编译没错。

经验分享 程序员 微信小程序 职场和发展