mingw 构建错误:对“__chkstk_ms"的未定义引用 [英] mingw building error: undefined reference to `__chkstk_ms'
问题描述
我刚刚在 windows 中安装了 mingw,我编写了一个 helloWorld 程序来测试它.代码:
I've just installed mingw in windows, and I write a helloWorld program to test it. Code:
#include <stdio.h>
int main(){
printf("hello, world!\n");
return 0;
}
结果:
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
There is a similar question asked here. But I checked the MinGW installation manager and it seems taht I didn't install old version of gcc or g++. Can any buddy help? Thanks!
顺便说一句,由于我使用的是pythonxy作为我的python环境,所以我的C:下还有一个C:/MinGW32-xy目录,它没有包含在系统变量'path'中.那会影响吗?
By the way, since I'm using pythonxy as my python environment, there is also a C:/MinGW32-xy directory under my C:, which is not included in the system variable 'path'. Would that affect?
推荐答案
好吧,我详细检查了我的系统变量,发现 C:/MinGW32-xy/bin 在 C:/MinGW/bin 之前.所以当我在命令行中输入 gcc -v 时,它显示 MinGW32-xy 正在工作.我改变了他们的顺序,问题解决了.但是,我真的不知道 MinGW 和 MinGW32-xy 之间的区别.哪位朋友可以给我一个提示?
Well, I checked my system varialble in detail and found that the C:/MinGW32-xy/bin was before C:/MinGW/bin. So when I typed gcc -v in the command line, it shows that MinGW32-xy was at work. I switched their order, the problem was solved. However, I don't really know the difference between the MinGW and MinGW32-xy. Can any buddy give me a hint?
这篇关于mingw 构建错误:对“__chkstk_ms"的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!