MinGW-w64库中的编译错误

时间:2014-12-11 17:39:46

标签: c++ gcc mingw mingw-w64

从MinGW更改为MinGW-w64后,我收到以下错误:

In file included from C:/MinGW/i686-w64-mingw32/include/stddef.h:7:0,
                 from C:/MinGW/lib/gcc/i686-w64-mingw32/4.9.2/include/stddef.h:1,
                 from C:\MinGW\include/stdint.h:24,
                 from C:\MinGW\include/inttypes.h:7,
                 from C:\MinGW\include/GL/glew.h:299,
                 from ..\main.cpp:1:
C:/MinGW/i686-w64-mingw32/include/crtdefs.h:26:9: error: 'size_t' does not name a type
 typedef size_t rsize_t;
         ^
In file included from C:/MinGW/lib/gcc/i686-w64-mingw32/4.9.2/include/stddef.h:1:0,
                 from C:\MinGW\include/stdint.h:24,
                 from C:\MinGW\include/inttypes.h:7,
                 from C:\MinGW\include/GL/glew.h:299,
                 from ..\main.cpp:1:
C:/MinGW/i686-w64-mingw32/include/stddef.h:20:3: error: 'errno_t' does not name a type
   errno_t __cdecl _set_errno(int _Value);
   ^
C:/MinGW/i686-w64-mingw32/include/stddef.h:21:3: error: 'errno_t' does not name a type
   errno_t __cdecl _get_errno(int *_Value);
   ^
C:/MinGW/i686-w64-mingw32/include/stddef.h:26:18: error: 'uintptr_t' does not name a type
   _CRTIMP extern uintptr_t __cdecl __threadhandle(void);
                  ^

任何人都可以向我解释这里发生了什么吗?

1 个答案:

答案 0 :(得分:2)

我昨天在使用Code :: Blocks设置MinGW-w64时遇到了这个问题,并以下列方式解决了这个问题...

请注意以下构建消息:

from C:/MinGW/i686-w64-mingw32/include/stddef.h:7:0,
                 from C:/MinGW/lib/gcc/i686-w64-mingw32/4.9.2/include/stddef.h:1,
                 from C:\MinGW\include/stdint.h:24,
                 from C:\MinGW\include/inttypes.h:7

编译器的搜索目录指向MinGW的include文件夹(我假设默认的32位编译器目录)和新安装的MinGW-w64编译器的include文件夹。

现在如果你的情况与我的情况类似,那么你已经完成了以下工作: (1)在全局编译器设置的“编译器”选项卡下,将MinGW中的include文件夹添加到MinGW(GNU GCC编译器)的搜索目录中 (2)在设置MinGW-w64编译器时复制GNU GCC编译器的设置

因此,在这种情况下,您需要做的是简单地从新编译器的搜索目录中删除旧编译器的include文件夹的路径。

如果有问题,请告诉我。