一、VScode下载和安装
下载 Visual Studio Code - Mac、Linux、Windows
下载完成之后傻瓜式安装即可
二、 左侧活动栏介绍
三、安装中文插件
先下载,在重启即可
四、配置C语言运行环境
1、Code Runner 记得勾选图中的两个选项
2、安装C/C++插件
3、安装编译器MinGW-W64 GCC
https://sourceforge.net/projects/mingw-w64/files/
下载完成后解压到某个路径,这个路径任意,我是放在安装路径下面D:\Microsoft VS Code\
4、配置环境变量
找到bin文件路径 D:\Microsoft VS Code\mingw64\bin
找到include文件路径 D:\Microsoft VS Code\mingw64\include
然后加入到path中
5、win+R,然后输入cmd,打开命令提示行,输入gcc -v -E -x c++ -,如果出现以下界面则配置成功。
6、 首先在桌面新建一个文件夹C(不要包含中文),然后打开vscode,在C文件夹路劲下新建三个文件 c_cpp_propertise.json、launch.json、tasks.json
c_cpp_propertise.json,注意将 "D:/Microsoft VS Code/mingw64"路径改成你自己的路径
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceRoot}",
"D:/Microsoft VS Code/mingw64/include/**",
"D:/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++",
"D:/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32",
"D:/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward",
"D:/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include",
"D:/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed",
"D:/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"__GNUC__=6",
"__cdecl=__attribute__((__cdecl__))"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "",
"path": [
"${workspaceRoot}",
"D:/Microsoft VS Code/mingw64/include/**",
"D:/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++",
"D:/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32",
"D:/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward",
"D:/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include",
"D:/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed",
"D:/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include"
]
}
}
],
"version": 4
}
launch.json,注意将 "D:/Microsoft VS Code/mingw64"路径改成你自己的路径
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch", // 配置名称,将会在启动配置的下拉菜单中显示
"type":"cppdbg", // 配置类型,这里只能为cppdbg
"request": "launch", //请求配置类型,可以为launch(启动)或attach(附加)
"program":"${workspaceFolder}/${fileBasenameNoExtension}.exe", // 将要进行调试的程序的路径
"args": [], // 程序调试时传递给程序的命令行参数,一般设为空即可
"stopAtEntry":false, // 设为true时程序将暂停在程序入口处,一般设置为false
"cwd":"${workspaceFolder}", // 调试程序时的工作目录,一般为${workspaceRoot}即代码所在目录workspaceRoot已被弃用,现改为workspaceFolder
"environment": [],
"externalConsole": true, // 调试时是否显示控制台窗口,一般设置为true显示控制台
"MIMode": "gdb",
"miDebuggerPath":"D:/Microsoft VS Code/mingw64/bin/gdb.exe", // miDebugger的路径,注意这里要与MinGw的路径对应
"preLaunchTask": "gcc", // 调试会话开始前执行的任务,一般为编译程序,c++为g++, c为gcc
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
}
]
}
]
}
tasks.json
{
"version": "2.0.0",
"command": "gcc", // 注意对应
"args":["-g","${file}","-o","${fileBasenameNoExtension}.exe"], // 编译命令参数
"problemMatcher": {
"owner": "cpp",
"fileLocation":["relative","${workspaceFolder}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
7、重启与调试。重启vscode,在文件夹C上新建一个以.c结尾的文件
五、配置keil编译环境
1、安装c/c++拓展
2、安装Keil Assitant插件,配置keil环境路径,安装完成后点击拓展设置,配置MDK环境路径
3、配置mingw64环境,可以gcc -v,如果有反应则已经配置成功,否则需要参考上述第四章里面的配置步骤配置
4、点击加号,在弹出的页面中选择测试工程,KEIL5工程文件后缀为 .uvprojx ,只能找到以此为后缀的工程,双击打开
5、如果出现keil中文乱码问题,下载插件GBKtoUTF8,安装成功后乱码消失
六、配置流程图环境
1、下载插件Draw.io Integration
2、新建一个文件以 .drawio 结尾,即可开始进行流程图绘制