1

我有静态库和另一个使用它的程序。

在静态库中,如果我在没有继承的情况下定义标题,它可以正常工作。

class TcpCommunication

另一方面,如果我对 QT 类使用 inheretence,

class TcpCommunication:public QTcpServer

编译使用此静态库的代码时出现链接错误。

>MStoDKAPId.lib(TcpCommunication.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QTcpServer::~QTcpServer(void)" (__imp_??1QTcpServer@@UAE@XZ) referenced in function "public: virtual __thiscall TcpCommunication::~TcpCommunication(void)" (??1TcpCommunication@@UAE@XZ)

可能是什么问题?谢谢。

4

2 回答 2

4

您需要添加对包含 QTcpServer 类定义的库的引用。

您的 IDE 应该有一个选项来指定链接选项,其中一个是库的名称,另一个是指定库的搜索路径。更新这两个以添加QT框架的路径/库。

于 2010-05-18T11:28:32.257 回答
3

使用静态库的应用程序还需要链接到 QT

于 2010-05-18T11:27:28.047 回答