开发者

Linkage Error with Inherited Class

I have static library and another program which uses it.

In the static library If I define header without inheretence it works fine.

class TcpCommunication

On the other hand If I use inheretence with a QT class,

class TcpCommunication:public QTcpServer

I'm getting linkage error when I compiling code which uses this static library.

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

What can be the problem? Thanks.


You need to add a reference to the library that contains the definition of the QTcpServer class.

Your IDE should have an option to specify link options, one of which will be the names of the libraries and another to specify search paths for libraries. Update these two to add the path / library of the QT framework.


The application using your static library also needs to link to QT

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜