dlopen错误 - 未定义的符号错误

时间:2017-04-17 08:40:37

标签: qt ubuntu-16.04

我已经通过Qt编译了库,它编译成功,但是当我读到库时,我得到了一个:error: undefined symbol。大多数错误都与我的课程相关联。

我找到了一些解决方案,但都没有。

这是错误输出:

1 个答案:

答案 0 :(得分:0)

我找到了答案,代码是在Windows之前运行的,我把它移到linux,虚拟类就像

#ifndef _CO_COMMUNICATION_H
#define _CO_COMMUNICATION_H
#include <string>
using namespace std;

class CCommunicationInterface
{
public:
    virtual ~CCommunicationInterface()=0;//this is the error
    virtual bool Send(const vector<byte>&  Data) = 0;
    virtual bool Receive(vector<byte> &InBuf) = 0;
    virtual bool Open(bool IsBackUpComm, wstring& ErrorMsg) = 0;
    virtual bool Close() = 0;
    virtual bool IniParam(pointer Param, wstring& ErrorMsg) = 0;

};

typedef CCommunicationInterface* (*PFN_COMMUNICATION_INTERFACE)();
typedef void (*PFN_RELEASE_COMMUNICATION_INTERFACE)(CCommunicationInterface* lpObj);

#endif

然后基于CCommunicationInterface创建一个类可以在Windows中成功编译。但是在linux中,它显示了错误。 所以,我改变了这个`

的代码
class CCommunicationInterface
    {
    public:
        virtual ~CCommunicationInterface(){}
        virtual bool Send(const vector<byte>&  Data) =0;
        virtual bool Receive(vector<byte> &InBuf) =0;
        virtual bool Open(bool IsBackUpComm, wstring& ErrorMsg) =0;
        virtual bool Close()=0;
        virtual bool IniParam(pointer Param, wstring& ErrorMsg)=0;

    };

然后我得到了ldd -r lib NoError, 该 分析函数的错误。

相关问题