{//使用IntelliSense了解相关属性。//悬停以查看现有属性的描述。//欲了解更多信息,请访问:https://go.microsoft.com/fwlink/?linkid=830387"version":"0.2.0","configurations":[{"name":"gcc-11 - 生成和调试活动文件","type":"cppdbg","request":"launch","program":"${fileDirname}/${fileBasenameNoExtension}","args":[],"stopAtEntry":false,"cwd":"${workspaceFolder}","environment":[],"externalConsole":false,"MIMode":"gdb","miDebuggerPath":"gdb","setupCommands":[{"description":"为gdb启用整齐打印","text":"-enable-pretty-printing","ignoreFailures":true}],"preLaunchTask":"Launch: build active file"}]}
tasks.json
JSON
{"version":"2.0.0","tasks":[{"type":"cppbuild","label":"Launch: build active file","command":"/usr/bin/gcc-11",//改成自己需要用的编译器"args":["-g","${file}","-o","${fileDirname}/${fileBasenameNoExtension}"],"options":{"cwd":"${workspaceFolder}"},"problemMatcher":["$gcc"],"group":"build","detail":"use /usr/bin/gcc-11"}]}
有时候会遇到VSCode提示更新includePath,这时候需要在wsl里执行 gcc-11 -v -E -x c++ -