MinGW编译C++出错
我从sourceforge下载的gcc 4.4,用g++编译如下代码没有错误但生成文件体积达3.6MB,且无法运行,环境变量我都设置好了,不知道是什么原因。
#include <iostream>
using namespace std;
int main()
{
for(int i = 0;i < 10;i++)
{
cout<<i<<endl;
}
return 0;
}
[解决办法]
libgcc_s_dw2-1.dll?
The file you're missing is packaged in gcc-core-4.4.0-mingw32-dll.tar.gz.
http://sourceforge.net/projects/mingw/files/GCC%20Version%204/gcc-core-4.4.0-mingw32-dll.tar.gz
http://n2.nabble.com/GCC-4.4.0---libgcc_s_dw2-1.dll-missing-td3178140.html
或者用编译选项:
-static-libgcc
http://sourceforge.net/project/shownotes.php?release_id=691876