sublime Text 2 配置 C++ 编译环境

配置好C++编译环境后,运行无输出的解决办法:

http://384444165.iteye.com/blog/1798107

 

我的安装过程:

0. 安装sublime text 2

1. 安装了code::blocks后,把C:\Program Files\CodeBlocks\MinGW\bin添加到系统变量Path中;

2. 在sublime中添加new build system(tool->build system->new build system),

文件名:g++ builder

内容:

{
    "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",
 
    "variants":
    [
        {
            "name": "Run",
            "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}", "&","${file_path}/${file_base_name}"]
        }
    ]
}

3. 试试ctrl+B运行cpp代码,如果没有输出,打开C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default下的exec.py,删除下面的内容(大概是43-44行,不同的版本不一致):

for k, v in proc_env.iteritems():
 proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding())

4. 这次应该能正常运行了,具体解决办法详见http://384444165.iteye.com/blog/1798107

posted @ 2013-10-09 11:26  努力变瘦  阅读(354)  评论(0编辑  收藏  举报