Windows上配置C語言開發環境(包含git)
- Auto-generated Table of Content
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
安裝 Msys2
Msys2官網 下載完成後輸入以下指令
安裝的過程中會看到 Proceed with installation? [Y/n] 打y就對了,之後執行其他指令遇到這個狀況也是相同的處理方式
指令執行完畢後會自動關閉應用程式,請重新打開一次並輸入相同指令
接著執行這個指令Mingw就安裝完成啦
設定環境變數
在這裡打環境變數 搜尋
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
接著會出現這個畫面,點選紅色框起來的地方
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
找到Path點選起來接著按下右下方的編輯按鈕
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
點擊右上方的新增按鈕,輸入綠色框起來的內容。最後一直點擊確定 結束所有視窗
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
這樣子就完成環境變數的設定了,接著按下Win+R快捷鍵輸入cmd並按下Enter
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
請輸入以下指令:
若執行指令都出現類似以下的訊息就表示成功囉
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
安裝 VScode
VScode官網
安裝完成後,先去這裡下載檔案並完成解壓縮
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
接著開啟VScode,點選框起來的部分
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
利用搜尋欄位安裝以下插件
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
插件安裝完後,點選檔案→從檔案開啟工作區
從剛剛解壓縮的資料夾找到 .code-workspace 結尾的檔案開啟
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
開啟檔案後尋找hello.c點擊查看程式碼
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
點選點選終端機→執行工作,點選紅色框起的地方,因為我打開的是.c檔
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
執行後會發現下方終端出現 hello 就表示成功了。同理,打開hello.cpp點選綠色框按鈕也會出現同樣效果。
Debug
現在要開始進行除錯(先設定好中斷點),按下執行並偵錯就可以開始除錯了。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
經過一番折騰,你已經可以Programs資料夾底下新建屬於你的專案進行開發了。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
在 VScode 中 Git 的使用
安裝Git for Windows
安裝好後,進入你的GitHub頁面挑選或建立一個repository複製網址
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
接著回到VScode,選定好資料夾並打開powershell輸入:
接著設定
這樣就大功告成了
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
以上內容的參考資料
【網頁設計】 VS Code、Git 與 GitHub 設定教學
How to set up Visual Studio Code for Executing and Debugging C Programs | Tutorial
Msys2官網