我刚刚在 mingw 上安装了 gcc 和 g++。我编写了一个非常简单的“hello world”程序来测试 g++ 编译器是否工作。代码:
#include <iostream>
using namespace std;
int main()
{
cout << "hello world" << endl;
return 0;
}
编译:
g++ Test.cpp
然后出现一些错误:
D:/MinGW[Finished in 0.6s with exit code 1]/bin/../lib/gcc/mingw32/3.4.5/../../../../mingw32/lib/crt2.o: In function `_mingw_setargv':
D:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../mingw32/lib/libmingwex.a(glob.o): In function `glob_match':
i:\p\giaw\src\pkg\mingwrt-4.0-1-mingw32-src\bld/../mingwrt-4.0.0-1-mingw32-src/src/libcrt/misc/glob.c:733: undefined reference to `__chkstk_ms'
D:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../mingw32/lib/libmingwex.a(glob.o): In function `glob_strdup':
i:\p\giaw\src\pkg\mingwrt-4.0-1-mingw32-src\bld/../mingwrt-4.0.0-1-mingw32-src/src/libcrt/misc/glob.c:85: undefined reference to `__chkstk_ms'
D:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../mingw32/lib/libmingwex.a(glob.o): In function `glob_match':
i:\p\giaw\src\pkg\mingwrt-4.0-1-mingw32-src\bld/../mingwrt-4.0.0-1-mingw32-src/src/libcrt/misc/glob.c:841: undefined reference to `__chkstk_ms'
D:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../mingw32/lib/libmingwex.a(glob.o): In function `glob_strdup':
i:\p\giaw\src\pkg\mingwrt-4.0-1-mingw32-src\bld/../mingwrt-4.0.0-1-mingw32-src/src/libcrt/misc/glob.c:85: undefined reference to `__chkstk_ms'
D:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../mingw32/lib/libmingwex.a(glob.o):i:\p\giaw\src\pkg\mingwrt-4.0-1-mingw32-src\bld/../mingwrt-4.0.0-1-mingw32-src/src/libcrt/misc/glob.c:85: more undefined references to `__chkstk_ms' follow
collect2: ld returned 1 exit status