vscodeC语言cl编译器调试配置-创新互联

microsoft 出品的 cl编译器运行/调试c配置,cl.exe 通过visual studio c ++ build tools 安装:vscodeC语言cl编译器调试
配置

launch.json:

创新互联专注于企业成都营销网站建设、网站重做改版、龙湾网站定制设计、自适应品牌网站建设、成都h5网站建设商城网站建设、集团公司官网建设、成都外贸网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为龙湾等各大城市提供网站开发制作服务。

2021-08-22:新版本vscode 已经将 externalConsole 配置项标记为废弃,更换为使用使用:  "console": "integratedTerminal",

 1 {
 2     "version": "0.2.0",
 3     "configurations": [
 4         { // 对应cl.exe 5             "name": "cl.exe build and debug active file",
 6             "type": "cppvsdbg",
 7             "request": "launch",
 8             "program": "${cwd}\out\${fileBasenameNoExtension}.exe",
 9             "args": [],
10             "stopAtEntry": false,
11             "cwd": "${workspaceFolder}",
12             "environment": [],
13  "externalConsole": true,
14  "console": "integratedTerminal",
         "preLaunchTask": "cl.exe build active file", 15 "logging": { // 用于消除PDB文件找不到打不开问题,来自于https://none53.hatenablog.com/entry/2019/11/28/vsCode_Cannot_find_or_open_the_PDB_file.16 "moduleLoad": false17 }, 18 "presentation": { 19 "focus": true20 } 21 } 22 ] 23 }

tasks.json: 需要在项目根目录建 out 文件夹

 1 {
 2   "version": "2.0.0",
 3   "tasks": [
 4         {    
 5  "type": "shell",
 6  "label": "cl.exe build active file",
 7  "command": "cl.exe",
 8  "args": [  
 9   "/Zi",
10   "/source-charset:utf-8",// 源文件编码,加上此行可以在文件中写中文注释也不会有IDE warning信息11   "/EHsc",
12   "/Fe:",
13   "${cwd}\out\${fileBasenameNoExtension}.exe",
14   "/Fo:",
15   "${cwd}\out\${fileBasenameNoExtension}.obj",
16   "${file}"17             ],
18  "group": {
19   "kind": "build",
20   "isDefault": true21             },
22  "presentation": {
23   "reveal": "always"24             },
25  "problemMatcher": "$msCompile"26         }
27     ]
28 }

Windows 环境变量 - >系统变量新建:

INCLUDE

值(按实际情况设置填值,这里是笔者安装Visual Studio 2019后的值):

C:Program Files (x86)Windows Kits10Include10.0.18362.0ucrt;C:Program Files (x86)Windows Kits10Include10.0.18362.0um;C:Program Files (x86)Windows Kits10Include10.0.18362.0winrt;C:Program Files (x86)Microsoft Visual Studio2019BuildToolsVCToolsMSVC14.27.29110include;C:Program Files (x86)Windows Kits10Lib10.0.18362.0ucrtx64;

LIB

值(按实际情况设置填值,这里是笔者安装Visual Studio 2019后的值):

C:Program Files (x86)Windows Kits10Lib10.0.18362.0ucrtx64;C:Program Files (x86)Windows Kits10Lib10.0.18362.0umx64;C:Program Files (x86)Microsoft Visual Studio2019BuildToolsVCToolsMSVC14.27.29110libx64;


当前名称:vscodeC语言cl编译器调试配置-创新互联
本文来源:http://csdahua.cn/article/docjsp.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流