Sublime Text 3配置C++编译运行


2016.9.8更新:

linux(Ubuntu16.04)下的配置,编译后用终端运行,解决了不能输入的问题

{
    "encoding": "utf-8",
    "working_dir": "$file_path",
    "shell_cmd": "g++ \"$file_name\" -o \"$file_base_name\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "selector": "source.c++",
 
    "variants": 
    [
        {    
        "name": "Run",
        "shell_cmd": "g++ '$file' -o '$file_base_name' && gnome-terminal -x bash -c \"'${file_path}/${file_base_name}';read -p '\nPress any key to continue...'\""
        }
    ]
}

 

 

————————

因为喜欢Sublime Text 3 的高亮配色,于是想在这里写程序。从emacs配置时连配置文件在哪都不知道到vim配置了半天很有成就感,我对配置文件算是更了解了。不过Sublime Text 3 没那么麻烦。配置C++编译运行的方法大概就是配置一个Build System。在cmd窗口运行且解决了中文乱码问题的c++编译配置如下:

{
    "encoding": "utf-8",
    "working_dir": "$file_path",
    "shell_cmd": "g++ -Wall -std=c++11 -fexec-charset=GBK \"$file_name\" -o \"$file_base_name\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "selector": "source.c++",
 
    "variants": 
    [
        {    
        "name": "Run",
            "shell_cmd": "g++ -Wall -std=c++11 -fexec-charset=GBK \"$file\" -o \"$file_base_name\" && start cmd /c \"\"${file_path}/${file_base_name}\" & pause\""
        }
    ]
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM