2017-04-17 142 views
0

我通過Qt編譯了庫,它編譯成功,但是當我編譯庫時,我得到了一個:error: undefined symbol。大多數錯誤都與我的課程相關聯。dlopen錯誤 - 未定義的符號錯誤

我找到了一些解決方案,但都沒有工作。

以下是錯誤輸出:

+0

您確定您包含在應用程序中的庫頭文件是最新的嗎?也許你正在使用它們的舊版本,或者你只需​​要清理和重建所有東西。 – mbjoe

+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, 的 解析函數的錯誤。