参考两篇经验:
http://blog.csdn.net/superbinbin1/article/details/10147421
https://jingyan.baidu.com/article/6b97984d83dfe51ca2b0bf0e.html
扎心了扎心了,关于安装包下载失败,需要断点续传的问题,已经在收藏夹中收藏了;
但是但是
安装了cygwin后,\cygwin64\bin\下的gcc,g++等.exe的前面都有x86_64-w64-mingw32-
因此,第一篇博文中出现的c.sublime-build代码被我改成了如下
{
"path": "C:\\cygwin64\\bin",
"cmd": ["x86_64-w64-mingw32-gcc", "${file}", "-o", "${file_path}/${file_base_name}.exe", "-lm", "-Wall", "&", "start", "${file_path}/${file_base_name}.exe"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c",
"shell": true,
"variants":
[
{
"name": "Run::cygwin",
"cmd": [ "start", "${file_path}/${file_base_name}.exe"]
}
]
}
其中的 "-I", "D:\\cygwin64\\usr\\include" 的作用我不懂啊,删了还可以用,就先这样吧……
另外,解决生成的程序一运行结束就退出的问题:
在return 0前加一行:getchar();既不会报错也可以是结果停住。
如此这般,我为什么不直接用IDE呢……