简体   繁体   English

使用Swig / Python的未定义符号rom外部库

[英]Undefined symbol rom external library with Swig/Python

I have looked at this question but it doesn't seem to help my case. 我已经看了这个问题,但似乎对我的情况没有帮助。

I have a C++ library that I am wrapping parts of using SWIG (unfortunately swig 2.0). 我有一个C ++库,在其中包装了使用SWIG的部分内容(不幸的是,swig 2.0)。 This library performs some socket communications with a remote server and I need to make use of it from Python. 该库执行与远程服务器的一些套接字通信,我需要从Python中使用它。 I am finally able to compile and link a .so file but during my testing, when importing the generated module, I get the following: 我终于可以编译和链接.so文件,但是在测试过程中,导入生成的模块时,我得到以下信息:

...
    _mod = imp.load_module('_YBB', fp, pathname, description)
ImportError: ./_YBB.so: undefined symbol: _Z11IPV4Gatewayhhhh

This undefined symbol equates to: 这个未定义的符号等于:

IPV4Gateway(unsigned char, unsigned char, unsigned char, unsigned char)

This is frustrating as I don't have a call to this function anywhere in the wrapped library. 这令人沮丧,因为在包装好的库中的任何地方都没有调用此函数。 So it must be in the underlying socket library that I am calling. 因此它必须在我正在调用的基础套接字库中。

Does anyone know what I have to do to clear up this undefined symbol? 有谁知道我该怎么做才能清除此未定义的符号?

Ah, never mind. 啊没关系。 It turns out that it was declared in a header file but never implemented. 事实证明,它在头文件中声明的,但从未实现。 So swig (correctly) wrote a wrapper for it but was never able to link against the underlying implementation (which didn't exist). 因此,swig(正确地)为此编写了一个包装器,但始终无法链接到基础实现(尚不存在)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM