VsCode C语言调试注意
VsCode调试注意
要调试的代码路径不能有中文,否则会报错。
如果需要中文,则需打开语言和区域点击管理语言设置


点击确定后弹出下面窗口

可以点击 稍后
注意:
这里更改设置后可能会导致其他程序字体显示错误,不过到时候还可以再改回来
下载的插件
1.CMaKe(用来调试代码,但好像没配合)

2.Code Runner(用于快捷运行代码)

配置文件代码
1.c_cpp_properties.json
{
"configurations": [
{
"name": "windows-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "C:/TDM-GCC-64/bin/g++.exe",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "windows-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}
2.launch.json (未完成)
{
"configurations": [
{
"type": "cmake",
"request": "launch",
"name": "CMake: 配置项目",
"cmakeDebugType": "configure",
"clean": false,
"configureAll": false
}
]
}
3.settings.json
{
"files.associations": {
"iostream": "cpp",
"ostream": "cpp"
},
"cmake.ignoreCMakeListsMissing": true,
"cmake.debugType": "debug",
"cmake.generator": "Ninja"
}
4.tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "g++.exe build active file",
"command": "C:/TDM-GCC-64/bin/g++.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\output\\${fileBasenameNoExtension}.exe"
// "d:/PROJECT/C/{fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "C:/TDM-GCC-64/bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
},
{
"type": "cppbuild",
"label": "C/C++: g++.exe 生成活动文件",
"command": "C:/TDM-GCC-64/bin/g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\output\\${fileBasenameNoExtension}.exe",
""
],
"options": {
"cwd": "C:/TDM-GCC-64/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "调试器生成的任务。"
}
]
}

浙公网安备 33010602011771号