避免使用swig包装时出现“未使用的typedef”警告
问题描述:
我使用swig作为包装来从我的python代码调用C++函数。我的问题是,会生成以下类型的很多警告,因为我包含Boost库的一部分。避免使用swig包装时出现“未使用的typedef”警告
/usr/local/include/boost/math/special_functions/bessel.hpp:744:4: warning: unused typedef
'boost_static_assert_typedef_747' [-Wunused-local-typedef]
有没有办法避免这种情况?我想用
-isystem /usr/local/include
作为一个标志,而不是
-I /usr/local/include
可以解决这个问题。但是我必须在哪里添加它?后一种选择是在我的setup.py目前实施:
#!/usr/bin/env python
"""
setup.py file for SWIG spherical_overlap
"""
from distutils.core import setup, Extension
spherical_overlap_module = Extension('_spherical_overlap',
sources=['spherical_overlap_wrap.cxx', 'spherical_overlap.cpp'],
swig_opts=['-c++', '-py3'],
extra_compile_args =['-lboost_system '],
include_dirs = ['/usr/local/include'],
)
setup (name = 'spherical_overlap',
version = '0.1',
author = "SWIG Docs",
description = """Simple swig spherical_overlap from docs""",
ext_modules = [spherical_overlap_module],
py_modules = ["spherical_overlap"],
)
答
,如果你想,只是为了避免警告你可以添加-Wno-unused-local-typedef
选项
谢谢,这是对我来说足够。我在'extra_compile_args'中加了'-Wno-unused-local-typedef'。 – physicsGuy