views:

37

answers:

2

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 QTcpServer::~QTcpServer(void)" (__imp_??1QTcpServer@@UAE@XZ) referenced in function "public: virtual __thiscall TcpCommunication::~TcpCommunication(void)" (??1TcpCommunication@@UAE@XZ)

What can be the problem? Thanks.

+3  A: 

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

Stewart
Of course you are right, I added QtNetworkd.lib, and problem is solved.
metdos
+4  A: 

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.

Skizz