家喻户晓vscode的json文件配置比拟麻烦,举荐整顿配置好的一套json用来加重前面配环境的折磨。
编译器应用的是MinGW64(clang和llvm始终没搞定),能够实现运行后弹出独立的黑框终端!生成的指标文件对立到一个文件夹!并无插件实现色调高亮!
留神源码中的很多门路要换成本人的!
c_cpp_properties.json文件(ctrl shift p -> edit configration 可生成此配置文件)
{ "configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}/**", "D:/DevelopSoft/MinGw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "compilerPath": "D:\\DevelopSoft\\MinGw64\\mingw64\\bin\\gcc.exe", "cStandard": "gnu17", "cppStandard": "c++17", "intelliSenseMode": "windows-gcc-x64", "configurationProvider": "ms-vscode.makefile-tools" } ], "version": 4}
launch.json(debug run 即可生成launch和tasks等json,我应用了IntelliSense插件)
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { // "type": "g++", "name": "task g++", "request": "launch" }, { "name": "g++.exe build and debug active file", "type": "cppdbg", "request": "launch", "program": "D:\\Code\\Vscode\\OUTPUTEXE\\${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "miDebuggerPath": "D:\\DevelopSoft\\MinGw64\\mingw64\\bin\\gdb.exe", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "task g++" } ]}
tasks.json
{ "version": "2.0.0", "tasks": [ { "type": "shell", "label": "task g++", //批改此项 "command": "D:\\DevelopSoft\\MinGw64\\mingw64\\bin\\g++.exe", "args": [ "-g", "${file}", "-o", "D:\\Code\\Vscode\\OUTPUTEXE\\${fileBasenameNoExtension}.exe", "-fexec-charset=GBK" ], "options": { "cwd": "D:\\DevelopSoft\\MinGw64\\mingw64\\bin" }, "problemMatcher": [ "$gcc" ], "group": "build" } ]}
settings.json(该文件次要用来设置色彩字体等界面元素类型,可本人批改色彩)
{ "editor.bracketPairColorization.enabled": true, "workbench.colorCustomizations": { "editorBracketHighlight.foreground1": "#ffd700", "editorBracketHighlight.foreground2": "#da70d6", "editorBracketHighlight.foreground3": "#87cefa", "editorBracketHighlight.foreground4": "#ffd700", "editorBracketHighlight.foreground5": "#da70d6", "editorBracketHighlight.foreground6": "#87cefa", "editorBracketHighlight.unexpectedBracket.foreground": "#ff0000" }, "editor.fontSize": 20, "editor.fontFamily": "Consolas"}
色彩显示如下: