某天想要开始使用vscode
但是突然发现,网上教程,一篇不会!!!
但是垃圾我终于自己捣鼓明白了这个玩意到底怎么用。。。
在此写篇教程,方便想要使用vscode的同学
链接:https://pan.baidu.com/s/1Ds7mRC1Ly5KzpHjdGeXuNg 密码:0zdw
mingw-w64
C:\mingw-w64\bin
g++ -v
,出现一堆东西表示环境变量配置成功 .vscode
launch.json
{
"version": "0.2.0",
"configurations": [ { "name": "C++ Launch (GDB)", "type": "cppdbg", "request": "launch", "targetArchitecture": "x86", "program": "${workspaceRoot}\\${fileBasename}.exe", "miDebuggerPath":"C:\\mingw-w64\\bin\\gdb.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceRoot}", "externalConsole": true, "preLaunchTask": "g++" } ] }
再在“.vscode”文件夹内新建文件c_cpp_properties.json
写上上这些并保存
{
"configurations": [ { "name": "Win32", "includePath": [ "${workspaceRoot}", "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++", "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32", "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward", "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.0/include", "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/tr1", "C:/mingw-w64/x86_64-w64-mingw32/include" ], "defines": [ "_DEBUG", "UNICODE", "__GNUC__=6", "__cdecl=__attribute__((__cdecl__))" ], "intelliSenseMode": "msvc-x64", "browse": { "path": [ "${workspaceRoot}", "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++", "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32", "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward", "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.0/include", "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/tr1", "C:/mingw-w64/x86_64-w64-mingw32/include" ] }, "limitSymbolsToIncludedHeaders": true, "databaseFilename": "" } ],
"version": 4 }
再在“.vscode”文件夹内新建文件tasks.json
写上并保存
{
"version": "0.1.0",
"command": "g++",
"args": ["-g","-std=c++11","${file}","-o","${workspaceRoot}\\${fileBasename}.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 } } }
教程完毕,有问题请留言