1
最新のcygwin g ++ - 5.4.0とpython3.4でこの問題が発生しました。簡単なコード以下は、この問題を公開します。cygwin g ++ Python.hでコンパイル(__BSD_VISIBLEの重複した定義)
In file included from /usr/include/python3.4m/Python.h:8:0,
from test.c:2:
/usr/include/python3.4m/pyconfig.h:1440:0: warning: "__BSD_VISIBLE" redefined
#define __BSD_VISIBLE 1
^
In file included from /usr/include/sys/config.h:5:0,
from /usr/include/_ansi.h:16,
from /usr/include/wchar.h:4,
from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/cwchar:44,
from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/bits/postypes.h:40,
from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/bits/char_traits.h:40,
from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/string:40,
from test.c:1:
/usr/include/sys/features.h:250:0: note: this is the location of the previous definition
#define __BSD_VISIBLE 0
^
In file included from /usr/include/python3.4m/pyport.h:335:0,
from /usr/include/python3.4m/Python.h:50,
from test.c:2:
/usr/include/sys/time.h:104:34: error: 'u_int' has not been declared bintime_mul(struct bintime *_bt, u_int _x)
:
#include <string>
#include <Python.h>
#include <vector>
#include <map>
//#include <string>
#include <iostream>
int main(int argc, char ** argv)
{
return 0;
}
"G ++ -g -O2 -std = C++ 11 test.cの-oテストpython3-config --includes
" でコンパイルした後、私はエラーを次しまいました
"Python.h"の後ろにインクルードすると難しいことが1つあります。コンパイルが完了します。私はlinux/Mac OS上でこの問題が表示されません。
これは有効な解決策ではありません。より複雑なコードでは、プログラムの初めに(メイン関数に入る前に)セグメントのデフォルトを実行します。