标签:配置 name ++ cmd c++ base file path sublime
1,安装编译器g++
下载地址:https://sourceforge.net/projects/mingw-w64/
装好mingw之后将bin/目录添加到path环境变量中去,然后再cmd中输入以下代码,测试是否装好
g++
如果出现下图所示情况,表面安装成功
2,在sublime中配置环境
tools > Build System > New Builed System
将其中的内容改成如下,并保存为CPP.sublime-build文件
{ //"shell_cmd": "make", "cmd": ["g++","-Wall", "${file}", "-o", "${file_path}/${file_base_name}"], "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", "working_dir": "${file_path}", "selector": "source.c, source.c++,source.cpp", "encoding": "cp936", "variants": [ {"name": "Run", "cmd": ["cmd", "/c", "g++", "-Wall","${file}", "-o", "${file_path}/${file_base_name}", "&&", "cmd", "/c", "${file_path}/${file_base_name}"] }, {"name": "RunInCommand", "cmd": ["cmd", "/c", "g++", "-Wall","${file}", "-o", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "${file_path}/${file_base_name} & echo.&pause"] }, {"name": "RunInShell", "shell_cmd": " start cmd /c \"\"${file_path}/${file_base_name}\"&pause\" " } ] }
然后Preferences > Key Bindings中输入一下内容
{"keys": ["f5"], "command": "build", "args": {"variant": "Run"}}, { "keys": ["f6"], "command": "build", "args": {"variant": "RunInCommand"} },
ctrl+n建立新文件,ctrl+s保存为.cpp文件,tools > Build System > CPP
写好之后f5或者f6编译运行程序
3,有用的控件
clang, EasyClangComplete、SublimeCodeIntel
标签:配置,name,++,cmd,c++,base,file,path,sublime 来源: https://www.cnblogs.com/54hys/p/10513666.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。