swig - CGAL 链接器错误 - 找不到符号 : ___gmpq_clear

标签 swig cgal

我正在尝试将 CGAL 合并到现有的模拟项目中,但遇到了一些链接器问题。 python 模拟 keiro.py 在 swig 包装器中使用一个名为 physics.cpp 的文件来加速常见操作......我设法让我的 physics.cpp 文件编译,但是运行 Python 模拟错误并显示以下消息:

Traceback (most recent call last): File "keiro.py", line 2, in from world import World, View File "/Users/marcstrauss/Desktop/keiro/world.py", line 9, in from fast.physics import Vec2d, Particle, World as PhysicsWorld File "/Users/marcstrauss/Desktop/keiro/fast/physics.py", line 7, in import _physics ImportError: dlopen(/Users/marcstrauss/Desktop/keiro/fast/physics.so, 2): Symbol not >found: __gmpq_clear Referenced from: /Users/marcstrauss/Desktop/keiro/fast/_physics.so Expected in: flat namespace in /Users/marcstrauss/Desktop/keiro/fast/_physics.so

我认为目标文件中未识别 ___gmpq_clear 符号的错误意味着我没有正确链接到 CGAL。这是我的生成文件:

all: physics.py _physics.so graphutils.py _graphutils.so

_physics.so: setup_physics.py physics_wrap.cxx physics.cpp python setup_physics.py build_ext --inplace -I/opt/local/include/

_graphutils.so: setup_graphutils.py graphutils_wrap.cxx graphutils.cpp python setup_graphutils.py build_ext --inplace -I/opt/local/include/

physics.py physics_wrap.cxx: physics.i physics.h swig -python -c++ physics.i

graphutils.py graphutils_wrap.cxx: graphutils.i graphutils.h swig -python -c++ graphutils.i -I/opt/local/include/ clean: rm -f physics.py rm -f graphutils.py rm -f *.cxx rm -f *~ *.pyc *.pyo rm -f *.so rm -rf build

有没有人能告诉我如何解决这个问题?谢谢!

最佳答案

在我的电脑上,__gmpq_clear 符号位于 libgmp 库中:

nm libgmp.a | grep gmpq_clear
00000000 T __gmpq_clear

尝试将 -lgmp 添加到您的链接命令。

关于swig - CGAL 链接器错误 - 找不到符号 : ___gmpq_clear,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4083285/

相关文章:

CGAL::Surface_mesh - 使用整数索引访问面/顶点?

C++ Vector Sort 方法编译失败,返回预期的表达式

c++ - 在 CGAL 中查找两个二维三角形的交集/差集的三角剖分结果

c - SSL_CTX_new :unable to load ssl2 md5 routines

c++ - SWIG:处理派生类中的基类重载方法

python - 无法确定从 SWIG(不是 ctypes)C 传递给 python 例程的正确参数

python - 从 Python 调用 C 函数(无返回值)

c++ - 哪个Qt库包含QApplication

rotation - CGAL:如何将一个 3D 矢量旋转到另一个矢量上?

c++ - 具有多边形相交和不精确构造内核的 CGAL Precondition_exception