PDA

View Full Version : Cannot create a QT exe+lib with Visual Studio 2005



trallallero
17th June 2010, 10:13
I have a big problem with VS+QT.
I'm working on a project called DGC (Dynamic Gui Creator) that is working on Linux Ubuntu but not in Windows XP.

I've tried with Cmake and with the QT4 VS add-in but nothing, I cannot create a library and an executable beacuse I get all these errors:

CMainApp.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall DynamicGUICreator::FreqButtonItem::metaObject(void )const " (?metaObject@FreqButtonItem@DynamicGUICreator@@UBE PBUQMetaObject@@XZ)
main.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall DynamicGUICreator::FreqButtonItem::metaObject(void )const " (?metaObject@FreqButtonItem@DynamicGUICreator@@UBE PBUQMetaObject@@XZ)
moc_CMainApp.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall DynamicGUICreator::FreqButtonItem::metaObject(void )const " (?metaObject@FreqButtonItem@DynamicGUICreator@@UBE PBUQMetaObject@@XZ)
... (many others similar)


If I create only the executable compiling and linking all the modules, it's ok, but if I create first the library and afterwards the executable that links to the library, I get all those errors.

Note that if I use the .pro files with Eclipse (mingw), everything works but the problem is that I have to compile with VS.

It seems that the created library has no moc information...

Can someone help me, please ?
thanks.

trallallero
17th June 2010, 13:51
I've seen that, if I create a static library, I don't get the previous linker errors but only the following (for each moc file):


DGClib.lib(moc_FreqButtonItem.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators

So, I think that the problem is in the generated moc files (.cxx) as the functions like qt_metacast or qt_metacall are not exported (__declspec(dllexport)).

Can somebody confirm ?