--- Title: VSCode C++ tags: VSCode, computer --- # 用 VSCode 寫 C/C++ 教學 - 同步發布於 https://github.com/liaojason2/vscode-cpp-for-windows ## VSCode 安裝 - [前往 VSCode 網站下載安裝檔](https://code.visualstudio.com/)  - 下載後開啟安裝程式  - 同意使用者條款  - 選擇下面的勾勾  - 確認安裝  - 安裝完成,會自動打開 VSCode  - 進入 Extenion  - 安裝 C/C++  - 安裝 C++ Intellisense  ## MinGW 安裝 - [進入 MinGW 下載頁面選取 mingw-get-setup.exe (檔案會自動下載)](https://sourceforge.net/projects/mingw/)  - 開啟下載下來的程式,選擇下一步</br>  - 選擇安裝位置後繼續 (與描述檔有關,除非你知道怎麼弄否則不要動)  - 安裝畫面</br>  - 安裝完後會啟動 MinGW Installer Manager,找到 mingw32-gcc-g++ (bin) 點取左方窗格,選擇 Mark for Installation  - 選左側 All Packages,找到 mingw32-gdb (bin) 點取左方窗格,選擇 Mark for Installation  - 選擇 Installation --> Apply Change  - 點選 Apply</br>  - 安裝中,安裝完成後點選 Close</br>  - 開啟檔案總管 --> 電腦 --> 內容  - 選取右側側進階系統設定  - 選擇環境變數</br>  - 在下面的系統變數找到 Path</br>  - 新增 C:\MinGW\bin 點選確定</br>  - 環境變數變更完畢後重新啟動 ## 開始撰寫 C/C++ - 在桌面上隨意新增資料夾</br>  - [進入 repository 主頁](https://github.com/liaojason2/vscode-cpp-for-windows),選擇 Clone or Download --> Download ZIP - 或在終端機輸入 `git clone https://github.com/liaojason2/vscode-cpp-for-windows.git`  - 在剛剛在桌面上的資料夾中新增 .vscode 資料夾  - 解壓縮後從下載下來的東西加入畫面中(畫面的四個檔案)  - 在桌面上對資料夾點選右鍵,選擇以 Code 開始</br>  - 點選資料按鈕新增檔案,取完檔名後開始輸入程式  - 輸入 `Ctrl+Shift+B` 進行編譯  - 輸入 Ctrl+Shift+\` 開啟終端機  - 輸入 `./<檔名>.exe`+`Enter`執行程式  ## 注意事項 - .vscode 必須與要編譯的檔案在同一個資料夾或是任一上層目錄 - vscode 必須以資料夾方式開啟才能編譯,即使是只寫一個檔案也一樣
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up