问题现象
使用c++ 11的语法报红,编译也是失败的
vector<int> vc = {1,2}
解决方案
卸载如下插件,如果有安装的话
最小化demo
目录结构
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Clang", //这个任务的名字在launch.json最后一项配置
"type": "shell",
"command": "clang++",
"args": [
"-std=c++17",
"-stdlib=libc++",
"-g",
// 生成调试信息,GUN可使用该参数
"${file}",
// file指正在打开的文件
"-o",
// 生成可执行文件
"${fileDirname}/${fileBasenameNoExtension}"
// fileDirname指正在打开的文件所在的文件夹
// fileBasenammeNoExtension指没有扩展名的文件,unix中可执行文件属于此类
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "clang++ - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "Clang"
}
]
}
参考文章
|