gpt4 book ai didi

python - 用 swig 包装时避免 "unused typedef"警告

转载 作者:太空狗 更新时间:2023-10-29 23:14:32 25 4
gpt4 key购买 nike

我使用 swig 作为包装器从我的 python 代码调用 c++ 函数。我的问题是,生成了很多以下类型的警告,因为我包含了 Boost 库的一部分。

/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 选项

关于python - 用 swig 包装时避免 "unused typedef"警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33393231/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com