sublime text 2 c++编译 环境 问题小结

闲来无事,想要用subllime text 2 写下c++小程序,以前没用过这个编译c++,

期间出过很多问题,但是安装了sublime text 3 直接可以使用,前提安装了gcc/g++ 编译,没安装的去 安装下MinGW,然后在 环境变量把 MinGW下的bin 加入,

新建LIBRARY_PATH变量,如果有的话,在值中加入MinGW下的lib;新建C_INCLUDEDE_PATH变量,值设为MinGW下的include。

不过本着找问题解决问题,查了不少,最终成功在sublime text 2上跑起来了c++ 

 

其中遇到

1.Sublime Text 2 编译c++没反应

去找C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default下的 exec.py中修改

os.environ["PATH"] =os.path.expandvars(path).encode(sys.getfilesystemencoding())

看一下你的exec.py的 40行是不是这个

45行 换成 proc_env[k] = os.path.expandvars(v.decode(sys.getfilesystemencoding())).encode(sys.getfilesystemencoding())

2.让Sublime text 2 的build系统支持中文路径和中文文件

Sublime text 2的build系统不支持中文路径,可以通过如下方式解决:

打开sublime_plugin.py文件(可以用Everything搜索)

添加以下内容:

reload(sys)
sys.setdefaultencoding(‘gbk‘)

3.Ctrl+shift+B 无法运行 

去C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\C++\C++.sublime-build

修改

// "cmd": ["bash", "-c", "g++ ‘${file}‘ -o ‘${file_path}/${file_base_name}‘ && ‘${file_path}/${file_base_name}‘"]
"cmd" : ["${file_path}/${file_base_name}"]

然后就可以正常运行了

 

 

sublime text 2 c++编译 环境 问题小结,布布扣,bubuko.com

sublime text 2 c++编译 环境 问题小结

上一篇:python 3Des 加密


下一篇:用Python做SVD文档聚类---奇异值分解----文档相似性----LSI(潜在语义分析)