我正在尝试为这个库创建一个 python 绑定:
http://code.google.com/p/hosterslib/。
我正在使用 swig,代码如下:
%module pyhosters
%{
#include "hosters/hosters.hpp"
%}
%include "hosters/hosters.hpp"
我跑
swig -c++ -python -o swig_wrap.cxx swig.i
我编译
g++ -O2 -fPIC -shared -o _pyhosters.so swig_wrap.cxx
python-config --libs --cflags
-lhosters -lcln -lhtmlcxxpkg-config libglog --libs --cflags
-I/usr/include/python2.6 -Wall -Wextra
但是当我运行 python 并导入它时,我得到:
>>> import pyhosters
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "./pyhosters.py", line 7, in <module>
import _pyhosters
ImportError: ./_pyhosters.so: undefined symbol: _ZN7hosters11hostersLink7getLinkEi
我该如何解决?
谢谢。