sublime下配置C/C++運行環境

    最近在學習《WEB前端課程》老師教咱們使用DW,可是不太喜歡,就選擇了sublime,寫前端代碼仍是很方便。前端

平時都是寫C++,C比較多,借鑑了別人的配置步驟,將sublime打形成IDE。就像這樣:linux

非常好看啊 哈哈哈。c++

step 1:找到c++編譯器shell

注意路徑下有g++.exe等文件,常見的編譯器有tdm,mingw,gcc等學習

step 2:配置環境變量code

就跟配JAVA環境變量同樣blog

step 3:sublime上的配置utf-8

按照圖中1,2,3的步驟點開相應操做、cmd

step 4:保存相關配置編譯器

注意看文件名

step:4-2編輯剛纔保存的文件(名字本身命名)

路徑通常在C\Users\你的用戶名\AppData\Roaming\Sublime Text 3\Packages\User    下 找到你剛命名的文件

寫入這些

{
    // "shell_cmd": "make"
    "encoding": "utf-8",
    "working_dir": "$file_path",
    "shell_cmd": "g++ -Wall -std=c++0x \"$file_name\" -o \"$file_base_name\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "selector": "source.cpp",

    "variants": 
    [
        {   
        "name": "Run",
            "shell_cmd": "g++ -Wall -std=c++0x  \"$file\" -o \"$file_base_name\" && \"${file_path}/${file_base_name}\""
        },
        {   
        "name": "RunInCmd",
            "shell_cmd": "g++ -Wall -std=c++0x  \"$file\" -o \"$file_base_name\" && start cmd /c \"\"${file_path}/${file_base_name}\" & pause \""
        }
    ]
}

 

 

step 5:運行後選擇剛纔設置的選項

運行成功,完成

 

優勢是linux Windows 均可以使用。

相關文章
相關標籤/搜索