2

我尝试在 msys2-mingw 上使用Python/C APImingw-w64-x86_64-python2 ,所以我安装了这个包,然后写main.cpp

#include <python2.7\Python.h>
int main(){
    return 0;
}

当我输入这个时$ g++ main.cpp -o main,它给了我这些味精:

In file included from \msys64\mingw64\include/python2.7\Python.h:58:0,
             from main.cpp:1:
\msys64\mingw64\include/python2.7\pyport.h:907:2: 錯誤:#error "LONG_BIT       definition appears wrong for platform (bad gcc/glibc config?)."
 #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  ^
In file included from \msys64\mingw64\include/python2.7\Python.h:8:0,
             from main.cpp:1:
/usr/include/cygwin/types.h:78:20: 錯誤:一個宣告指定了多個類型
 typedef __uint32_t uid_t;
                ^
/usr/include/cygwin/types.h:78:20: 錯誤:沒有宣告任何東西 [-fpermissive]
/usr/include/cygwin/types.h:84:20: 錯誤:一個宣告指定了多個類型
 typedef __uint32_t gid_t;
                ^
/usr/include/cygwin/types.h:84:20: 錯誤:沒有宣告任何東西 [-fpermissive]
makefile:2: recipe for target 'main' failed
make: *** [main] Error 1

我不知道为什么会发生这些。这不是一个错误linking file(因为我没有链接任何文件。)。我的方法是错误的,还是我包含了错误的文件?

4

1 回答 1

3

你混合 GCC 的:mingw-w64 GCC 和 msys GCC。对于 MSYS2 下的 mingw-w64 GCC,您不得包含来自 /usr 的内容。查看您的错误消息/usr/include/cygwin/types.h

于 2015-02-01T16:45:49.847 回答