相信看到这里的小伙伴已经经历了安装配置VS Code的重重困难,不要灰心,学习编程语言的第一道考验就是安装配置编译环境,UP主这里帮你一站式解决问题,助你快速入门!进入正题 。
分割线-----------------------------------------------------------------------------------------------------------
一:彻底卸载VS Coded 注:如果不是第一次下载安装VS Code就会发现无论怎么卸载,都会保留原来配置 。
1,win+R键打开运行,输入%%回车
2,删除Code和Code文件夹
3,运行栏再次输入%%
4,删除.文件夹
二:下载安装VS Code
VS Code官网:Code - Code .
一直点击下一步,注意勾选:添加到path(重启后生效)
完成安装
三:配置环境变量
众所周知,一个开发环境的配置,必不可少的是配置环境变量
1去mingw官网,向下拉,找到如图文件,进行下载;
ps:官网下载速度极慢,附下载链接链接:
提取码:gxfc
ps:记住下载路径!!!
2.复制文件中bin的地址,如图
3.搜索栏中搜索编辑系统环境变量;
点击环境变量
4.系统变量中的path
5.新建变量,粘贴bin地址,点击确定
6.环境变量配置完成之后,进入win+R,输入cmd进入控制台,输入g++,出现下图,则说明mingw环境变量配置成功
四:配置VS Code语言编辑环境 1.打开VS Code下载中文插件和C/C++插件
2.在电脑新建文件夹CODE(名称可以随意,切记路径中不能有中文)
打开VS Code单击文件,选择打开文件夹,打开刚刚创立的文件CODE,选择新建文件夹以 .
命名
文章插图
选择文件夹.右键单击,选择新建文件,在.新建3个文件,分别以.json;.json;tasks.json命名 。
3.在.json文件中输入代码,可以复制
{"configurations": [{"name": "Win32","includePath": ["${workspaceRoot}","D:/yzx/Microsoft VS Code/mingw64/include/**","D:/yzx/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++","D:/yzx/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32","D:/yzx/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward","D:/yzx/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include","D:/yzx/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed","D:/yzx/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:/yzx/Microsoft VS Code/mingw64/include/**","D:/yzx/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++","D:/yzx/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32","D:/yzx/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward","D:/yzx/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include","D:/yzx/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed","D:/yzx/Microsoft VS Code/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include"]}}],"version": 4}
注意:上段代码中需要修改路径,将代码中路径修改成自己电脑中......./bin/后续路径代码无需修改,只需要修改bin前的代码,修改复制过程中注意斜杠/反斜杠\的区别,需要修改代码段如下图
(共两段)
4.在.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:\\yzx\\Microsoft VS Code\\mingw64\\bin\\gdb.exe",// 自己电脑的gdb"preLaunchTask": "echo",//这里和task.json的label相对应"setupCommands": [{"description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true}]}]}
- 巴比特 | 元宇宙每日必读:如何依托自身资源参与布局元宇宙?
- 苹果系统安装python环境_mac下python相关环境搭建(python开发
- java偏功能实现的面试题,教你如何做面霸
- 如何治疗体内螨虫
- 不粘锅选重的还是轻的,如何选购不粘锅
- win10系统打开计算机慢,Windows10系统打开文件夹速度很慢如何解决
- 如何解决 :libstdc++.so
- C#读取文件:按行读取
- 工业物联网系统下如何实现设备数据采集与设备维护
- 不易掉色的自制染发剂,如何自制植物染发剂