問題: 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安裝環境是用MinGW編譯,但在編譯的過程覺得很繁瑣,要經過三個步驟,如下所示:
- 在要編譯的畫面按 ctrl+shift+B
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 →
- 拖拉 .exe至下方 -> 按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 →
解決
後來發現LLVM編譯器裡的Clang的編譯功能可以解決這個問題,讓編譯過程更加便利
- 下載LLVM
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裡安裝"C/C++ Clang Command Adapter"的套件
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 →
- 安裝完之後,如果急著按編譯就會出現如下的警告"Please install clang or check configuration clang.executable",因為我們已經安裝Clang所以問題是第二個,configuration clang.executable
- 參考官網,還要在VSCode裡設定檔案的位置。
按F1 -> 搜尋User Settings -> 搜尋clang.executable -> 原本預設的是clang,此處要改成LLVM\bin 的檔案位置(看你自己存在哪邊,修改後的結果如下圖所示)
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 →
- 以後就可以直接按"▷"進行編譯囉!