
超简单的配置VS Code的C++运行环境教程
?????????????????[??????] ??????????????????[????????] ?Path???Codeblocks??????MinGW\bin?[????????]
发布日期:2021-05-07 23:14:50
浏览次数:18
分类:精选文章
本文共 2083 字,大约阅读时间需要 6 分钟。
????VS Code
1. ????VS Code
??VS Code??????????????????[????]
?????????????????????????2. ??C++??
??VS Code?????????[??????]
??????C/C++????[C/C++??????] ?????????????????????VS Code?????Codeblocks???
??Codeblocks???????MinGW????[Codeblocks????]
?????????????????????????????????
????.vscode??
?????????????VS Code?[?????VS Code??]
???????.vscode??????tasks.json?launch.json?[??????]
????????tasks.json?launch.json??
{ "version": "2.0.0", "command": "g++", "args": ["-g", "${file}", "-o", "${fileBasenameNoExtension}.exe"], "problemMatcher": { "owner": "cpp", "fileLocation": ["relative", "${workspaceRoot}"], "pattern": { "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 } }}
{ "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceRoot}/${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceRoot}", "environment": [], "externalConsole": true, "MIMode": "gdb", "miDebuggerPath": "C:/Program Files/CodeBlocks/MinGW/bin/gdb.exe", "preLaunchTask": "g++", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ]}
???launch.json?miDebuggerPath?????Codeblocks???????
??????
?????????????????????Hello World??????????
#includeusing namespace std;int main() { system("pause"); cout << "Hello World!" << endl; return 0;}
?F5????????Hello World???????????return 0;??system("pause");
??????