此时重启之后就是汉化之后的界面了
1.解压此文件夹到一个文件夹(路径不要带有中文)
2.打开此文件
3.找到文件中的bin文件,复制地址
4.打开环境变量
5.打开path
6.点击‘新建’,将刚刚复制的地址粘贴进去,点击确定
7.打开cmd,在命令行窗口输入gcc -v -E -x c++ -
,出现以下内容表示环境配置成功
1.安装C/C++
2.在桌面创建一个文件夹,用来存放C文件
3.在文件夹中创建一个.c文件和一个.vscode的文件夹
4.在.vscode文件夹中创建三个.json文件
c_cpp_properties.json
文件内容:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceRoot}",
"D:/VSCODE/EXE/mingw64/include/**",
"D:/VSCODE/EXE/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++",
"D:/VSCODE/EXE/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32",
"D:/VSCODE/EXE/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward",
"D:/VSCODE/EXE/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include",
"D:/VSCODE/EXE/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed",
"D:/VSCODE/EXE/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:/VSCODE/EXE/mingw64/include/**",
"D:/VSCODE/EXE/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++",
"D:/VSCODE/EXE/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32",
"D:/VSCODE/EXE/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward",
"D:/VSCODE/EXE/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include",
"D:/VSCODE/EXE/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed",
"D:/VSCODE/EXE/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include"
]
}
}
],
"version": 4
}
launch.json
文件内容:
{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "cmd",
"preLaunchTask": "echo",
"args": [
"/C",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"&",
"echo.",
"&",
"pause"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole":true
},
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "D:\\VSCODE\\EXE\\bin\\gdb.exe",// 自己电脑的gdb
"preLaunchTask": "echo",//这里和task.json的label相对应
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
tasks.json
文件内容:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "gcc",
"args": [
"-g",
"${file}",
"-o",
"${fileBasenameNoExtension}.exe",
"-fexec-charset=GBK"//解决中文乱码
]
}
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
}
}
5.将c_cpp_properties.json
中的路径改成自己的实际路径
6.将launch.json
中的路径也改成自己的实际路径
7.在VScode中打开创建的文件夹
8.写一个简单的"Hello,World!"代码
9.运行代码(F5)检查C环境是否配置成功,打印出"Hello,World!"即成功!(可以将.vscode中的三个文件保存起来,以后创建.c文件时直接复制即可)
VScode中不仅能打开keil工程,还能够进行修改和编译
1.安装Embedded IDE插件
2.点击设置工具链
3.选择’Keil MDK’
4.找到keil安装路径,选择’TOOLS.INI’文件
5.导入keil工程
6.选择MDK
7.导入成功
8.编译工程
9.在烧录配置处进行设置后,可以直接使用JLink将程序烧录到开发板
到此,VScode配置C环境和导入keil工程完毕!
2022.9.9更新:VScode安装包及C/C++环境配置文件下载