2

msys2-mingw でPython/C APIを使用しようとしているので、このパッケージをインストールして、次のようmingw-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 に答える