共计 2283 个字符,预计需要花费 6 分钟才能阅读完成。
家喻户晓 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"
}
色彩显示如下:
正文完
发表至: visual-studio-code
2022-08-10