我正在尝试使用VS Code编译一些C ++代码,并且在使用其他C ++版本时遇到了一些麻烦。我想使用选项-std=c++17
对其进行编译,因为有些事情我只需要测试C ++ 17中的工作(默认情况下,Clang使用C ++ 14)。因此,我尝试编辑tasks.json文件以手动添加使用C ++ 17的选项。但是,即使这样做,也似乎无济于事。
起初,我只编辑了[[g ++构建活动文件]的options
部分],但是,由于它似乎不起作用,我将该选项添加到了所有任务中。不幸的是,这也没有帮助。你能告诉我我在哪里犯错了吗?您可以在下面的tasks,json文件中找到tasks部分。"tasks": [
{
"type": "shell",
"label": "clang build active file",
"command": "/usr/bin/clang",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"-std=c++17"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "clang build active file",
"command": "/usr/bin/clang",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"-std=c++17"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
},
{
"type": "shell",
"label": "g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"-std=c++17"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
}
]
我正在尝试使用VS Code编译一些C ++代码,并且在使用其他C ++版本时遇到了一些麻烦。我想用选项-std = c ++ 17编译它,因为我需要测试工作...