首先安裝mingw,mingw是gnu在windows下的一個實現,對於咱們這個需求,比用cygwin更加合適c++
官網以下說windows
MinGW compilers provide access to the functionality of the Microsoft C
runtime and some language-specific runtimes. MinGW, being Minimalist,
does not, and never will, attempt to provide a POSIX runtime
environment for POSIX application deployment on MS-Windows. If you
want POSIX application deployment on this platform, please consider
Cygwin instead.app
安裝也很是容易 http://www.mingw.org/wiki/Getting_Startedide
直接去此頁面下載,而後安裝時選擇安裝c編譯器,固然若是忘記勾選,直接cmd命令行this
mingw-get install gcc g++ mingw32-make
都是能夠的命令行
將C:\MinGW\bin 加入環境變量而後新建sublime text 2編譯規則
{
"cmd": ["gcc","${file}", "-o", "${file_path}/${file_base_name}"],
//"cmd": ["make"],
"file_regex": "^(..[^:]):([0-9]+):?([0-9]+)?:? (.)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",orm
"variants":
[
{
"name": "Run",
"cmd": ["${file_path}/${file_base_name}"]
}
]
}ci
以後重啓sublime text2 就能夠了開發
若是懶得配置能夠下載CodeBlocks的集成開發環境,這個自帶mingw,直接能夠開發了,get
不過我仍是以爲重量了點,sublime text2配合mingw很是輕量級