--- title: Mac VSCode 寫 C/C++ 教學 tags: VSCode, computer --- # Mac VSCode 寫 C/C++ 教學 ## 特別感謝 - [@angel-star](https://github.com/angel-star) 提供相關檔案 ## 安裝 Xcode - 進入 Mac App Store 搜尋 Xcode 並下載 ![](https://i.imgur.com/grP8mV9.png) - 在終端機輸入 `xcode-select --install` ![](https://i.imgur.com/DTe7i53.png) ## 安裝 VSCode - 進入 VSCode 官網並[下載](https://code.visualstudio.com/) ![](https://i.imgur.com/qbd2nzf.png) - 解壓縮後拖到應用程式 ![](https://i.imgur.com/vJeMfL0.png) ![](https://i.imgur.com/g2SveMo.png) - 開啟 VSCode 選擇 Extenion ![](https://i.imgur.com/Ir10vqt.png) - 安裝 C/C++ ![](https://i.imgur.com/prHJqKL.png) - 安裝 C++ Intellisense ![](https://i.imgur.com/fNKsQ4Z.png) ## 開始撰寫 C/C++ - 進入 repository 選擇 Clone or Download --> Download ZIP - 或在終端機輸入 `git clone https://github.com/liaojason2/vscode_template_for_Mac.git` ![](https://i.imgur.com/TaysdSi.png) - 下載完後進行解壓縮 ![](https://i.imgur.com/An6KiQH.png) - 隨便開一個資料夾 ![](https://i.imgur.com/a1m4UsD.png) - 進入解壓縮後的檔案,在鍵盤上打`Command+Shift+.`檢視隱藏檔案,複製 .vscode 至剛剛隨意新增的資料夾內 ![](https://i.imgur.com/clTnc5L.png) ![](https://i.imgur.com/n5AXW5w.png) - 開啟 VSCode ![](https://i.imgur.com/1zblZ1T.png) - 開啟剛剛隨意新增的資料夾 ![](https://i.imgur.com/7LjImZ0.png) - 選擇 New File 新增檔案 ![](https://i.imgur.com/pni5640.png) - 撰寫程式 ![](https://i.imgur.com/Hx3ML7I.png) - 按 `Command+Shift+B` 進行編譯 ![](https://i.imgur.com/8IaU5NQ.png) - 按 Ctrl+Shift+\` 開啟終端機![](https://i.imgur.com/L2BZXCd.png) - 輸入 ./<檔名>.out 即可執行程式 ![](https://i.imgur.com/sAQ9tlc.png)
×
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