Try   HackMD

sublime&&MinGW安裝教學


新版 sublime + MinGW 教學

link


下載

安裝

安裝DEV-C++跟Sublime Text 3

安裝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 →

  • 安裝完成後按Continue

    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 →

  • 在每個白框框按右鍵

  • 選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 →

  • Installation->Apply Changes

    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 →

偷ConsolePauser取得return值

  • 從C:\Program Files (x86)\Dev-Cpp\
  • 找到ConsolePauser.exe複製
  • 放到C:\MinGW\bin\裡
  • (然後DEV就可以刪了)
    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

  • 在下方系統變數的PATH點兩下
  • 新增C:\MinGW\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 →

設定Sublime Text 3

  • 開啟Sublime Text 3,Tools->Build System->New Build System

設定C++.sublime-build

  • 在打開的文件打上這些內容

  • 儲存在預設的C:\Users\User\AppData\Roaming\Sublime Text 3\Packages\User\

  • 檔名設成C++.sublime-build

完成!嘗試編譯

  • 按下Ctrl+B 選擇C++ 14
  • 以後編譯只需按下Ctrl+B

附錄1: 添加自動排版功能

安裝package control

  • 按下Ctrl+Shift+P
  • 打上package control並下載

安裝sublimeAstyleFormatter

  • 一樣按下Ctrl+Shift+P
  • 這次多了很多東西,選package install
  • 搜尋sublimeAstyleFormatter並下載

調整設定

  • 進到Preferences->Package Settings->SublimeAstyleFormatter->Settings-Default

  • 找到"autoformat_on_save"並改成true

完成!試著用用看吧

  • 在.cpp檔或是任何C++的檔案裡按下儲存(Ctrl+S)或是編譯(Ctrl+B)就會自動排版了

before

after