[Qt-interest] Windows DLL Linking Static Qt

Finley Lee finleyl at alienskin.com
Wed Aug 26 23:29:45 CEST 2009


I'm attempting to build a Windows DLL which links to a static build of
the Qt library.  When I build my DLL, the linker emits the following
errors:

 

qtdll.obj : warning LNK4217: locally defined symbol
??0QObject@@QAE at PAV0@@Z (public: __thiscall QObject::QObject(class
QObject *)) imported in function "public: __thiscall
TestClass::TestClass(void)" (??0TestClass@@QAE at XZ)

qtdll.obj : warning LNK4217: locally defined symbol ??1QObject@@UAE at XZ
(public: virtual __thiscall QObject::~QObject(void)) imported in
function "public: virtual __thiscall TestClass::~TestClass(void)"
(??1TestClass@@UAE at XZ)

qtdll.obj : error LNK2001: unresolved external symbol "public: virtual
struct QMetaObject const * __thiscall TestClass::metaObject(void)const "
(?metaObject at TestClass@@UBEPBUQMetaObject@@XZ)

qtdll.obj : error LNK2001: unresolved external symbol "public: virtual
void * __thiscall TestClass::qt_metacast(char const *)"
(?qt_metacast at TestClass@@UAEPAXPBD at Z)

qtdll.obj : error LNK2001: unresolved external symbol "public: virtual
int __thiscall TestClass::qt_metacall(enum QMetaObject::Call,int,void *
*)" (?qt_metacall at TestClass@@UAEHW4Call at QMetaObject@@HPAPAX at Z)

debug\QtDLL2.dll : fatal error LNK1120: 3 unresolved externals

NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual
Studio 9.0\VC\BIN\link.EXE"' : return code '0x460'

Stop.

NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual
Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2'

Stop.

 

My qmake file looks like this:

 

TEMPLATE = lib

LANGUAGE = C++

CONFIG += qt dll debug_and_release

VERSION = 2.9.0

 

SOURCES += qtdll.cpp

 

I have tried to add 'static' and remove 'shared' from the CONFIG
variable, but that doesn't seem to make any difference.   I am new to
Qt, so I'm sure I'm missing something obvious.  Any idea what it might
be?

 

Thanks,

 

-Finley

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090826/e05ca327/attachment.html 


More information about the Qt-interest-old mailing list