【发布时间】:2020-05-27 10:34:42
【问题描述】:
用 vscode 编译我的 c++ 程序。名称中有空格的文件没有被编译
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "shell: g++.exe build active file",
"command":"C:\\Program Files (x86)\\CodeBlocks\\MinGW\\bin\\g++.exe",
"args": ["-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe", "-std=c++11"],
"options": {
"cwd":"C:\\Program Files (x86)\\CodeBlocks\\MinGW\\bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}```
【问题讨论】:
-
最简单的解决方案是不要让文件名包含空格。
-
使用
"\"${file}\""并引用 .exe,就像 Sam 所说的更好:永远不要在文件名中使用空格
标签: c++ visual-studio-code compiler-errors compilation