我正在嘗試將CGAL整合到現有的模擬項目中,但我遇到了一些鏈接器問題。 python模擬keiro.py在swig包裝中使用名爲physics.cpp的文件來加速常用操作......我設法讓我的physics.cpp文件進行編譯,但運行Python模擬錯誤時出現以下消息:CGAL鏈接器錯誤 - 未找到符號:___gmpq_clear
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
有沒有人有任何想法,我如何解決這個問題?謝謝!
答案解決了您的問題嗎?我目前有類似的問題? – Endophage 2012-01-19 00:40:03
是的,它的確如此。至少對於我來說。我在Mac OS X Lion下使用Xcode 4。我使用MacPorts安裝CGAL。 – 2012-05-24 07:55:30