我刚刚在windows中安装了mingw,并编写了一个helloWorld程序来测试它。代码:
#include <stdio.h>
int main(){
printf("hello, world!\n");
return 0;
}
Result:
C:/MinGW/lib/crt2.o:crt1.c:(.text+0x1f1): undefined reference to `__chkstk_ms'
C:/MinGW/lib/libmingwex.a(glob.o):glob.c:(.text+0x5e3): undefined reference to `__chkstk_ms'
C:/MinGW/lib/libmingwex.a(glob.o):glob.c:(.text+0x690): undefined reference to `__chkstk_ms'
C:/MinGW/lib/libmingwex.a(glob.o):glob.c:(.text+0x7e9): undefined reference to `__chkstk_ms'
C:/MinGW/lib/libmingwex.a(glob.o):glob.c:(.text+0x82d): undefined reference to `__chkstk_ms'
C:/MinGW/lib/libmingwex.a(glob.o):glob.c:(.text+0xc0d): more undefined references to `__chkstk_ms' follow
有一个类似的问题被问到here https://stackoverflow.com/questions/18649173/how-to-solve-undefined-reference-to-chkstk-ms-on-mingw。但我检查了MinGW安装管理器,似乎我没有安装旧版本的gcc或g++。有哪位朋友可以帮忙吗?谢谢!
顺便说一下,由于我使用 pythonxy 作为我的 python 环境,所以我的 C: 下还有一个 C:/MinGW32-xy 目录,该目录不包含在系统变量“path”中。那会影响吗?
好吧,我详细检查了我的系统变量,发现 C:/MinGW32-xy/bin 位于 C:/MinGW/bin 之前。所以当我在命令行中输入 gcc -v 时,它表明 MinGW32-xy 正在工作。我改变了他们的顺序,问题就解决了。
但是,我真的不知道 MinGW 和 MinGW32-xy 之间的区别。有哪位朋友可以给我指点一下吗?
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)