VScode
這是一篇推坑vscode的安裝教學文
各方大神有自己的教派的請自己寫一篇
註:我才不會去SITCON跟別人發起宗教戰爭
內容會以c++為主,比較閒的時候再把python補上
大家應該都用windows吧,用mac的如果有困難我再想辦法
名為簡介的廢話
VScode
Visual Studio Code(簡稱VS Code)是一款由微軟開發且跨平台的免費原始碼編輯器
Visual Studio Code預設支援非常多的程式語言
包括JavaScript、TypeScript、CSS和HTML
也可以通過下載擴充支援Python、C/C++、Java和Go在內的其他語言
支援功能包括語法突顯、括號補全、代碼摺疊和代碼片段
對於部分語言,可以使用IntelliSense
Visual Studio Code也支援除錯Node.js程式
和GitHub的Atom一樣,Visual Studio Code也基於Electron框架構建
文本編輯器?整合式開發環境(IDE)?
文本編輯器顧名思義就是用來修改編輯文字檔的
我們也知道大多是程式語言都是文檔
文本編輯器百百種,早期大戰過的vi(以及衍生版本)和Emacs
甚至在維基上有一個頁面編輯器之戰
vscode身為輕量級文本編輯器,跟IDE相比占用電腦資源少很多
跨平台的特性也支援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 →
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++的,需要附加模組支援
左邊點選Extenion
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 →
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 →
C++開發環境
安裝MinGW
MinGW導入了大多數GNU編譯器,打#include幾乎都是往裡面找標頭檔
下載MinGW,往下拉下載.exe結尾的執行檔
基本上就一路按確認
確認一下安裝路徑是C:/MinGW
安裝完開啟MinGW Installer Manager
找到mingw32-gcc-g++-bin點擊然後選Mark for Installation
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 →
在左邊All Packages
找到mingw32-gdb-bin一樣選擇Mark for Installation
圖片勘誤 是mingw32-gdb-bin 不是mingw32-gcc-bin
mingw32-gcc-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 →
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 →
設定環境變數
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 →
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 →
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 →
對四個檔案的解釋
c_cpp_properties是程式碼自動完成的設定
tasks跟建置有關
launch是偵錯用的
setting是vscode其他環境的設定檔
下載不了的這裡有程式碼可以自己建
c_cpp_properties.json
launch.json
settings.json
tasks.json
以上要塞進.vscode這個資料夾
VScode還有很多好用而且強大的插件,這裡就先不一一介紹
不過推個好用的code runner
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 runner自己的output來輸出
建議可以在setting加上"code-runner.runInTerminal": true
來使用終端機跑
沒意外可以按Ctrl+Alt+N編譯並執行,執行前記得先按Ctrl+S存檔
只要不關閉文件,存檔後Ctrl+Z, Ctrl+Shift+Z還是可以用
不小心打出無窮迴圈或是程式感覺快爆炸可以按Ctrl+Alt+M