220 字
1 分钟
VS Code编译cpp环境配置
其他的网上都能找到
我这只放三个文件
放在.vscode下
c_cpp_properties.json
{ "configurations": [ { "name": "Linux", "includePath": [ "${workspaceFolder}/**" ], "defines": [], "compilerPath": "/usr/bin/gcc", "cStandard": "c11", "cppStandard": "gnu++11", "intelliSenseMode": "linux-gcc-x64", "compilerArgs": [] } ], "version": 4}launch.json
{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(gdb) 启动", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "externalConsole": false, "MIMode": "gdb", "setupCommands": [ { "description": "为 gdb 启用整齐打印", "text": "-enable-pretty-printing", "ignoreFailures": false }, ], "preLaunchTask": "C/C++: g++ 生成活动文件", "miDebuggerArgs": "-q -ex quit; wait() { fg >/dev/null; }; /bin/gdb -q --interpreter=mi", "miDebuggerPath": "/usr/bin/gdb"
} ]}tasks.json
{ "version": "2.0.0", "tasks": [ { "type": "cppbuild", "label": "C/C++: g++ 生成活动文件", "command": "g++", "args": [ "${file}", "-fdiagnostics-color=always", "-o", "${fileDirname}/${fileBasenameNoExtension}", "-g3", "-pipe", "-Wall", "-D_DEBUG" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": "build", "detail": "编译器: /usr/bin/g++" }, ]}以上配置文件基于linux,windows其实同理,运行就按ctrl+F5
VS Code编译cpp环境配置
https://blog.aloys233.top/posts/vs-code编译cpp环境配置/