错误痛饮:不确定的符号:_ZN7hosters11hostersLink7getLinkei
-
22-09-2019 - |
题
我在尝试做一个python结合,为这个图书馆:
http://code.google.com/p/hosterslib/.
我使用口,继承人是代码:
%module pyhosters
%{
#include "hosters/hosters.hpp"
%}
%include "hosters/hosters.hpp"
我运行
口-c++-蟒蛇-o swig_wrap.cxx痛饮.我
和我汇编与
g++-O2-fPIC-shared-o_pyhosters.所以swig_wrap.cxx
python-config --libs --cflags
-lhosters-lcln-lhtmlcxxpkg-config libglog --libs --cflags
-I/usr/include/python2.6-墙壁-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
我怎么解决?
谢谢。
解决方案
这是错位名称:
hosters::hostersLink::getLink(int)
确保你已经界定这一职能。
好吧,我拿来看看主机托管服务提供商0.6.头声明两个文件 getLink
方法:
std::string getLink(void);
std::string getLink(int n);
但是,源文件只有声明的第一种:
std::string hostersLink::getLink(void) {return Link;}
但痛饮创造包装这些职能螺钉的事情了。我建议做两件事之一:
- 删除
std::string getLink(int n);
方法,因为它是不确定的。 - 增加的定义
std::string getLink(int n) { ... }
不隶属于 StackOverflow