服务器之家

服务器之家 > 正文

Windows10配置VSCode C++环境(超详细,面向小白以及大佬们)

时间:2021-08-08 17:12     来源/作者:张俊浩

我看了网上的大佬们配的我是在是看不懂啊?我是一个小白啊?这太难了,这阻挡不了我,想使用这很骚的IDE,于是在不断的摸索下,终于配置成功,小白们也不用慌,这次非常简单。一定可以的。

1.下载 VS Code

下载网址:https://code.visualstudio.com/

2.运行安装程序

Windows10配置VSCode C++环境(超详细,面向小白以及大佬们)

一定不要忘记把Path那一条点上。

3.装MinGW

当时我下了半天找不到,这次我放个地址,github放不下这么大的文件,传文件夹的话还得ssh啥的,还不会,将就一下http://www.zzvips.com/softs/438773.html

下载完了直接放到C盘根目录下,没多大,只有600M,这样的话,就不用改我配置的路径什么的了!

Windows10配置VSCode C++环境(超详细,面向小白以及大佬们)

这样就完事了,然后是配置环境变量。

4.环境变量

会配的直接跳过即可

Windows10配置VSCode C++环境(超详细,面向小白以及大佬们)

Windows10配置VSCode C++环境(超详细,面向小白以及大佬们)

Windows10配置VSCode C++环境(超详细,面向小白以及大佬们)

Windows10配置VSCode C++环境(超详细,面向小白以及大佬们)

找到这两个path,用户和系统变量。

点击新建,然后输入 C:\MinGW\bin

Windows10配置VSCode C++环境(超详细,面向小白以及大佬们)

这样环境变量就配置完了

检查 win+R cmd 输入 gcc -v

Windows10配置VSCode C++环境(超详细,面向小白以及大佬们)

这样就配完了

5.倒数第二步

下载地址,解压出来 https://github.com/DuYuren/MinGW/tree/vscode

建个文件夹随便什么名字

把我的 .vscode 放里面

Windows10配置VSCode C++环境(超详细,面向小白以及大佬们)

6.最后一步

Windows10配置VSCode C++环境(超详细,面向小白以及大佬们)

然后在刚才那个文件夹里写个C++文件,就可以编译了,F5呦。

如果纯粹是来找json文件的
大佬们改改位置就能用

c_cpp_properties.json

  1. {
  2. "configurations": [
  3. {
  4. "name": "Win32",
  5. "includePath": [
  6. "${workspaceFolder}/**",
  7. "C:/MinGW/include/*"
  8. ],
  9. "defines": [
  10. "_DEBUG",
  11. "UNICODE",
  12. "_UNICODE"
  13. ],
  14. "compilerPath": "C:/MinGW/bin/gcc.exe",
  15. "cStandard": "c11",
  16. "cppStandard": "c++17",
  17. "intelliSenseMode": "gcc-x64"
  18. }
  19. ],
  20. "version": 4
  21. }

launch.json

  1. {
  2. "version": "0.2.0",
  3. "configurations": [
  4. {
  5. "name": "(gdb) Launch",
  6. "type": "cppdbg",
  7. "request": "launch",
  8. "targetArchitecture": "x86",
  9. "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
  10. "miDebuggerPath": "c:\\MinGW\\bin\\gdb.exe",
  11. "args": [],
  12. "stopAtEntry": false,
  13. "cwd": "${fileDirname}",
  14. "externalConsole": true,
  15. "preLaunchTask": "g++"
  16. }
  17. ]
  18. }

settings.json

  1. {
  2. "files.associations": {
  3. "vector": "cpp",
  4. "random": "cpp",
  5. "iostream": "cpp",
  6. "array": "cpp",
  7. "atomic": "cpp",
  8. "*.tcc": "cpp",
  9. "bitset": "cpp",
  10. "cctype": "cpp",
  11. "cfenv": "cpp",
  12. "charconv": "cpp",
  13. "chrono": "cpp",
  14. "cinttypes": "cpp",
  15. "clocale": "cpp",
  16. "cmath": "cpp",
  17. "codecvt": "cpp",
  18. "complex": "cpp",
  19. "condition_variable": "cpp",
  20. "csetjmp": "cpp",
  21. "csignal": "cpp",
  22. "cstdarg": "cpp",
  23. "cstddef": "cpp",
  24. "cstdint": "cpp",
  25. "cstdio": "cpp",
  26. "cstdlib": "cpp",
  27. "cstring": "cpp",
  28. "ctime": "cpp",
  29. "cuchar": "cpp",
  30. "cwchar": "cpp",
  31. "cwctype": "cpp",
  32. "deque": "cpp",
  33. "forward_list": "cpp",
  34. "list": "cpp",
  35. "unordered_map": "cpp",
  36. "unordered_set": "cpp",
  37. "exception": "cpp",
  38. "algorithm": "cpp",
  39. "functional": "cpp",
  40. "iterator": "cpp",
  41. "map": "cpp",
  42. "memory": "cpp",
  43. "memory_resource": "cpp",
  44. "numeric": "cpp",
  45. "optional": "cpp",
  46. "ratio": "cpp",
  47. "regex": "cpp",
  48. "set": "cpp",
  49. "string": "cpp",
  50. "string_view": "cpp",
  51. "system_error": "cpp",
  52. "tuple": "cpp",
  53. "type_traits": "cpp",
  54. "utility": "cpp",
  55. "fstream": "cpp",
  56. "future": "cpp",
  57. "initializer_list": "cpp",
  58. "iomanip": "cpp",
  59. "iosfwd": "cpp",
  60. "istream": "cpp",
  61. "limits": "cpp",
  62. "mutex": "cpp",
  63. "new": "cpp",
  64. "ostream": "cpp",
  65. "scoped_allocator": "cpp",
  66. "shared_mutex": "cpp",
  67. "sstream": "cpp",
  68. "stdexcept": "cpp",
  69. "streambuf": "cpp",
  70. "thread": "cpp",
  71. "typeindex": "cpp",
  72. "typeinfo": "cpp",
  73. "valarray": "cpp"
  74. },
  75. "editor.fontFamily": "Consolas, 'Fira code', monospace",
  76. "C_Cpp.errorSquiggles": "Disabled"
  77. }

tasks.json

  1. {
  2. "version": "2.0.0",
  3. "command": "g++",
  4. "type": "shell",
  5. "presentation": {
  6. "echo": true,
  7. "reveal": "always",
  8. "focus": false,
  9. "panel": "shared",
  10. "showReuseMessage": true,
  11. "clear": false
  12. },
  13. "args": ["-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe"],
  14. "problemMatcher": {
  15. "owner": "cpp",
  16. "fileLocation": ["relative", "${workspaceRoot}"],
  17. "pattern": {
  18. "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
  19. "file": 1,
  20. "line": 2,
  21. "column": 3,
  22. "severity": 4,
  23. "message": 5
  24. }
  25. }
  26. }

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。

原文链接:https://blog.csdn.net/weixin_43627118/article/details/103497983

标签:

相关文章

热门资讯

yue是什么意思 网络流行语yue了是什么梗
yue是什么意思 网络流行语yue了是什么梗 2020-10-11
2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全
2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全 2019-12-26
背刺什么意思 网络词语背刺是什么梗
背刺什么意思 网络词语背刺是什么梗 2020-05-22
苹果12mini价格表官网报价 iPhone12mini全版本价格汇总
苹果12mini价格表官网报价 iPhone12mini全版本价格汇总 2020-11-13
2021德云社封箱演出完整版 2021年德云社封箱演出在线看
2021德云社封箱演出完整版 2021年德云社封箱演出在线看 2021-03-15
返回顶部