vscode配置教程+如何解决vscode中文的问题
写在前面
关于Msys2下载的疑问,网上的资源丰富,故本文不做解答。但是提醒一下,更新的时候不要用。
一、安装vscode
进入vscode官网:https://vscode.cdn.azure.cn/stable/6c3e3dba23e8fadc360aed75ce363ba185c49794/VSCodeSetup-x64-1.81.1.exe,选择你要下载的类型,即可下载。
下载时只要把第2页“我不同意此协议”改成“我同意此协议”就行了。
二、配置vscode
1.我们需要下载Chinese (Simplified) (简体中文) Language Pack for Visual Studio Code这个插件,点击左侧第5个按扭,输入“chinese”,选择这个插件,点击“install”,下载好了下发会出现一个小窗口,点击这个小窗口的蓝色的按钮就可以改成中文了。
2.再在这个地方搜索“C++”,选择第一个,点击安装,因为我下载过了,所以我这没有。
3.你要下一个c++MinGW64的包,我下的位置是D:/Msys2-64bit/,就是Msys2的,自行修改。随便写一个c++代码,运行,他会给你丢出一个报错,不管他,你会发现多了一个.VSCODE文件夹,里面还有一个.vscode文件夹,点击去,创建4个文件(有了直接在里面改),如下所示:
c_cpp_properties.json
{
"configurations": [
{
"name": "windows-gcc-x64",
"includePath": [
"${workspaceFolder}/**",
""
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.22000.0",
"compilerPath": "D:/Msys2-64bit/ucrt64/bin/gcc.exe",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "windows-gcc-x64"
}
],
"version": 4
}
launch.json
{
"configurations": [
{
"name": "C/C++: g++.exe build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "D:\\msys2-x86_64\\ucrt64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe build active file"
},
{
"name": "C/C++: g++.exe 生成和调试活动文件",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "D:/Msys2-64bit/ucrt64",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "D:\\Msys2-64bit\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "将反汇编风格设置为 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe 生成活动文件"
},
{
"name"