python - SWIG 不支持 include_next GNU 指令
问题描述
我正在尝试使用 swig 为用 C++ 编写的库生成 python 绑定。
当我在 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++/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_next
指令的文件是cmath
complex.h
cstdlib
stdlib.h
tgmath.h
fenv.h
math.h
bits/std_abs.h
你推荐什么解决方案来解决这个问题?
解决方案
删除-includeall
. 这试图为每个包含的头文件中的每个函数递归地制作 swig 包装器。您通常只需要自定义 API 标头中的函数。
推荐阅读
- r - RMongo 可以连接到 MongoDB 云吗?
- r - R“全局变量没有可见绑定”在子例程中创建变量并返回环境时注意
- python - 在python unicode错误unicodeescape中导入csv文件
- angular - 使用 observables 进行平滑的鼠标移动跟踪
- laravel - 如何显示我使用 Laravel 上传的图像
- laravel-5 - 修复如何使用程序 ID 获取课程记录
- c - 即使未指定某些元素,C 中静态分配的数组是否会使用所有内存?
- mysql - 在目标表具有一对一的情况下使用 hasManyThrough
- android - 如何避免使用圆形图标?
- python - python中的多进程是否至少花费0.3s?