有关VS Code 配置C++ 6.5.0 版本的配置json
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe - 生成和调试活动文件",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "D:\\Program Files (x86)\\TDM-GCC-64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "task g++"
}
]
}
setting.json
{
"files.associations": {
"iostream": "cpp",
"*.tcc": "cpp",
"ratio": "cpp",
"system_error": "cpp",
"array": "cpp",
"functional": "cpp",
"regex": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"ostream": "cpp",
"deque": "cpp",
"string": "cpp",
"vector": "cpp",
"unordered_set": "cpp"
}
}
task.json
{
"tasks": [
{
"type": "shell",
"label": "task g++",
"command": "D:\\Program Files (x86)\\TDM-GCC-64\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"-std=c++14",
"-fexec-charset=GBK", // 处理mingw中文编码问题
"-finput-charset=UTF-8",// 处理mingw中文编码问题
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "C/C++: cpp.exe build active file",
"command": "D:\\Program Files (x86)\\TDM-GCC-64\\bin\\cpp.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
}
],
"version": "2.0.0"
}