1. 程式人生 > 程式設計 >Windows10配置VSCode C++環境(超詳細,面向小白以及大佬們)

Windows10配置VSCode C++環境(超詳細,面向小白以及大佬們)

我看了網上的大佬們配的我是在是看不懂啊?我是一個小白啊?這太難了,這阻擋不了我,想使用這很騷的IDE,於是在不斷的摸索下,終於配置成功,小白們也不用慌,這次非常簡單。一定可以的。

1.下載 VS Code

下載網址:https://code.visualstudio.com/

2.執行安裝程式

在這裡插入圖片描述

一定不要忘記把Path那一條點上。

3.裝MinGW

當時我下了半天找不到,這次我放個地址,github放不下這麼大的檔案,傳資料夾的話還得ssh啥的,還不會,將就一下https://www.jb51.net/softs/438773.html

下載完了直接放到C盤根目錄下,沒多大,只有600M,這樣的話,就不用改我配置的路徑什麼的了!

在這裡插入圖片描述

這樣就完事了,然後是配置環境變數。

4.環境變數

會配的直接跳過即可

在這裡插入圖片描述

在這裡插入圖片描述

在這裡插入圖片描述

在這裡插入圖片描述

找到這兩個path,使用者和系統變數。

點選新建,然後輸入 C:\MinGW\bin

在這裡插入圖片描述

這樣環境變數就配置完了

檢查 win+R cmd 輸入 gcc -v

在這裡插入圖片描述

這樣就配完了

5.倒數第二步

下載地址,解壓出來 https://github.com/DuYuren/MinGW/tree/vscode

建個資料夾隨便什麼名字

把我的 .vscode 放裡面

在這裡插入圖片描述

6.最後一步

在這裡插入圖片描述

然後在剛才那個資料夾裡寫個C++檔案,就可以編譯了,F5呦。

如果純粹是來找json檔案的
大佬們改改位置就能用

c_cpp_properties.json

{
  "configurations": [
    {
      "name": "Win32","includePath": [
        "${workspaceFolder}/**","C:/MinGW/include/*"
      ],"defines": [
        "_DEBUG","UNICODE","_UNICODE"
      ],"compilerPath": "C:/MinGW/bin/gcc.exe","cStandard": "c11","cppStandard": "c++17","intelliSenseMode": "gcc-x64"
    }
  ],"version": 4
}

launch.json

{
  "version": "0.2.0","configurations": [
    {
      "name": "(gdb) Launch","type": "cppdbg","request": "launch","targetArchitecture": "x86","program": "${fileDirname}\\${fileBasenameNoExtension}.exe","miDebuggerPath": "c:\\MinGW\\bin\\gdb.exe","args": [],"stopAtEntry": false,"cwd": "${fileDirname}","externalConsole": true,"preLaunchTask": "g++"
    }
  ]
}

settings.json

{
  "files.associations": {
    "vector": "cpp","random": "cpp","iostream": "cpp","array": "cpp","atomic": "cpp","*.tcc": "cpp","bitset": "cpp","cctype": "cpp","cfenv": "cpp","charconv": "cpp","chrono": "cpp","cinttypes": "cpp","clocale": "cpp","cmath": "cpp","codecvt": "cpp","complex": "cpp","condition_variable": "cpp","csetjmp": "cpp","csignal": "cpp","cstdarg": "cpp","cstddef": "cpp","cstdint": "cpp","cstdio": "cpp","cstdlib": "cpp","cstring": "cpp","ctime": "cpp","cuchar": "cpp","cwchar": "cpp","cwctype": "cpp","deque": "cpp","forward_list": "cpp","list": "cpp","unordered_map": "cpp","unordered_set": "cpp","exception": "cpp","algorithm": "cpp","functional": "cpp","iterator": "cpp","map": "cpp","memory": "cpp","memory_resource": "cpp","numeric": "cpp","optional": "cpp","ratio": "cpp","regex": "cpp","set": "cpp","string": "cpp","string_view": "cpp","system_error": "cpp","tuple": "cpp","type_traits": "cpp","utility": "cpp","fstream": "cpp","future": "cpp","initializer_list": "cpp","iomanip": "cpp","iosfwd": "cpp","istream": "cpp","limits": "cpp","mutex": "cpp","new": "cpp","ostream": "cpp","scoped_allocator": "cpp","shared_mutex": "cpp","sstream": "cpp","stdexcept": "cpp","streambuf": "cpp","thread": "cpp","typeindex": "cpp","typeinfo": "cpp","valarray": "cpp"
  },"editor.fontFamily": "Consolas,'Fira code',monospace","C_Cpp.errorSquiggles": "Disabled"
}

tasks.json

{
 "version": "2.0.0","command": "g++","type": "shell","presentation": {
  "echo": true,"reveal": "always","focus": false,"panel": "shared","showReuseMessage": true,"clear": false
 },"args": ["-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe"],"problemMatcher": {
  "owner": "cpp","fileLocation": ["relative","${workspaceRoot}"],"pattern": {
   "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$","file": 1,"line": 2,"column": 3,"severity": 4,"message": 5
  }
 }
}

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支援我們。