添加:
"C_Cpp.default.compilerArgs": [
"-g",
"${file}",
"-std=c++11",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
之后修改文件c_cpp_properties.json
修改:
"cStandard": "c11",
"cppStandard": "c++11",
修改文件tasks.json
"args": [
"-std=c++11",
"-stdlib=libc++",
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
由于我们使用了Code Runner插件,故在这个插件中也要添加-std=c++11
修改添加:
"cpp": "cd $dir && g++ -std=c++11 $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",