vscode
首先,我们要创建一个文件夹,名字随便(当做我们写代码的文件夹)。
然后再这个文件夹里面建一个叫 .vscode 的文件夹。
我们找到dev-c++的文件夹。点进MinGW64>bin。
再在 .vscode 文件夹里面创建下面这几个文件,并复制下面的代码进对应的文件
把这个文件夹(bin)搞到环境变量的PATH里面(这个可以去往上查)。
再用bin里面的g++.exe的路径替换掉我下面的注释为嘻嘻嘻的那几行的C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\g++.exe。(记得用我这种表示文件路径的方式,两个反斜杠)。
再用gdb.exe替换掉我下面注释为哈哈哈的那一行的文件路径
c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\Program Files (x86)\\Dev-Cpp\\MinGW64\\bin\\g++.exe", //嘻嘻嘻
"cStandard": "c14",
"cppStandard": "c++14",
"intelliSenseMode": "windows-gcc-x64"
// "compilerArgs": [
// "/W4"
// ]
}
],
"version": 4
}
launch.json:
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) 启动",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\Program Files (x86)\\Dev-Cpp\\MinGW64\\bin\\gdb.exe",//哈哈哈
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "将反汇编风格设置为 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
settings.json:
{
"files.autoSave": "afterDelay",
"files.autoGuessEncoding": true,
"workbench.list.smoothScrolling": true,
"editor.cursorSmoothCaretAnimation": "on",
"editor.smoothScrolling": true,
"editor.cursorBlinking": "smooth",
"editor.mouseWheelZoom": true,
"editor.formatOnPaste": true,
"editor.formatOnType": false,
"editor.formatOnSave": true,
"editor.wordWrap": "on",
"editor.guides.bracketPairs": true,
//"editor.bracketPairColorization.enabled": true, (此设置vscode在较新版本已默认开启)
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.acceptSuggestionOnEnter": "smart",
"editor.suggestSelection": "recentlyUsed",
"window.dialogStyle": "custom",
"debug.showBreakpointsInOverviewRuler": true,
"code-runner.runInTerminal": true,
"code-runner.saveAllFilesBeforeRun": true,
"code-runner.saveFileBeforeRun": true,
"code-runner.executorMap": {
"cpp": "cd $dir && g++ -std=c++14 $fileName -o $fileNameWithoutExt.exe && $dir$fileNameWithoutExt.exe"
},
"files.associations": {
"iostream": "cpp",
"chrono": "cpp",
"random": "cpp",
"limits": "cpp",
"valarray": "cpp",
"iosfwd": "cpp"
}
}
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe 生成活动文件",
"command": "C:\\Program Files (x86)\\Dev-Cpp\\MinGW64\\bin\\g++.exe",//嘻嘻嘻
"args": [
"-fdiagnostics-color=always",
"-g",
"-Wall",
"-std=c++14",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "编译器: C:\\Program Files (x86)\\Dev-Cpp\\MinGW64\\bin\\g++.exe"
}
]
}
下面是我的插件。



Fira code
运行代码可以按Ctrl+`打开终端。
不断使用cd命令到你的代码的文件夹。
输入 g++ 你的代码文件名字.cpp -o 你的代码文件名字 -std=c++14 -Wall 编译
然后输入 ./你的代码文件名字(不加.cpp)运行

浙公网安备 33010602011771号