Python SWIG不支持include_next GNU指令
我试图用C++编写一个用C++编写的库,使用SWIG生成Python绑定。p> 当我在Debian GNU/Linux 10上运行时Python SWIG不支持include_next GNU指令,python,c++,swig,Python,C++,Swig,我试图用C++编写一个用C++编写的库,使用SWIG生成Python绑定。p> 当我在Debian GNU/Linux 10上运行时 swig -I/usr/include \ -I/usr/include/c++/8 \ -I/usr/include/c++/8/tr1 \ -I/usr/include/linux \ -I/usr/include/x86_64-linux-gnu \ -I/usr/include/x86_64-linux-gnu/c+
swig -I/usr/include \
-I/usr/include/c++/8 \
-I/usr/include/c++/8/tr1 \
-I/usr/include/linux \
-I/usr/include/x86_64-linux-gnu \
-I/usr/include/x86_64-linux-gnu/c++/8 \
-I/usr/share/swig3.0/python \
-I$(KALDI_ROOT)/tools/openfst/src/include \
-I$(KALDI_ROOT)/src \
-includeall -c++ -python ConstArpaLmRescoring.i
输出是
/usr/include/c++/8/cstdlib:75: Error: Unknown SWIG preprocessor directive: include_next (if this is a block of target language code, delimit it with %{ and %})
/usr/include/c++/8/bits/std_abs.h:38: Error: Unknown SWIG preprocessor directive: include_next (if this is a block of target language code, delimit it with %{ and %})
/usr/include/c++/8/bits/c++0x_warning.h:32: Error: CPP #error "This file requires compiler and library support \
for the ISO C++ 2011 standard. This support must be enabled \
with the -std=c++11 or -std=gnu++11 compiler options.". Use the -cpperraswarn option to continue swig processing.
/usr/include/c++/8/cmath:45: Error: Unknown SWIG preprocessor directive: include_next (if this is a block of target language code, delimit it with %{ and %})
make: *** [Makefile:38: all] Error 1
包含include\u next
指令的文件是cmath
complex.h
cstdlib
stdlib.h
tgmath.h
fenv.h
bits/std\u abs.h
您建议采用什么解决方案来解决此问题?删除
-includeall
。它试图递归地为包含的每个头文件中的每个函数创建swig包装器。您通常只需要自定义API头中的函数。删除-includeall
。它试图递归地为包含的每个头文件中的每个函数创建swig包装器。您通常只需要自定义API头中的函数