This isn't a question but a declaration of my own stupidity. If I can save you some hours of banging your head against the wall then I hope this helps.

I'm using Qt 4.4.0 on Windows with MSVC 2008 Express, although I'm sure this could happen to anyone when compiling on windows.

The problem happens when you have one library linking against another library. I use the following code to export classes on windows:

Qt Code:
  1. #if defined(Q_OS_WIN32)
  2. # ifdef MYLIB
  3. # define MYEXPORT Q_DECL_EXPORT
  4. # else
  5. # define MYEXPORT Q_DECL_IMPORT
  6. # endif
  7. #else
  8. # define MYEXPORT
  9. #endif
  10.  
  11. class MYEXPORT myclass : public QObject {
  12. //...
  13. }
To copy to clipboard, switch view to plain text mode 

If I try to be sneaky and use the same MYEXPORT macro in both libraries and then try to link them together i get a mess of errors like this:

Qt Code:
  1. cl -c -nologo -Zm200 -Zc:wchar_t- -O2 -MD -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DAXISLIB -DQT_DLL -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"c:\qt\msvc\4.4.0\include\QtUiTools" -I"c:\qt\msvc\4.4.0\include\QtCore" -I"c:\qt\msvc\4.4.0\include\QtCore" -I"c:\qt\msvc\4.4.0\include\QtGui" -I"c:\qt\msvc\4.4.0\include\QtGui" -I"c:\qt\msvc\4.4.0\include\QtXml" -I"c:\qt\msvc\4.4.0\include\QtXml" -I"c:\qt\msvc\4.4.0\include\QtSql" -I"c:\qt\msvc\4.4.0\include\QtSql" -I"c:\qt\msvc\4.4.0\include" -I"..\libaxis" -I"c:\qt\msvc\4.4.0\include\ActiveQt" -I".tmp" -I"." -I"c:\qt\msvc\4.4.0\mkspecs\default" -Fo.tmp\ @C:\DOCUME~1\root\LOCALS~1\Temp\nm1648.tmpclientmodule.cpp
  2. link /LIBPATH:"c:\qt\msvc\4.4.0\lib" /NOLOGO /INCREMENTAL:NO /DLL /MANIFEST /MANIFESTFILE:".tmp\mylib.intermediate.manifest" /OUT:..\bin\mylib.dll @C:\DOCUME~1\root\LOCALS~1\Temp\nm1649.tmp
  3. Creating library ..\bin\mylib.lib and object ..\bin\mylib.exp
  4. clientmodule.obj : error LNK2019: unresolved external symbol "public: static struct QMetaObject const MyObject::staticMetaObject" (?staticMetaObject@MyObject@@2UQMetaObject@@B) referenced in function "public: static class QString __cdecl MyObject::tr(char const *,char const *)" (?tr@MyObject@@SA?AVQString@@PBD0@Z)
  5. clientmodule.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall MyObject::metaObject(void)const " (?metaObject@MyObject@@UBEPBUQMetaObject@@XZ)
  6. clientmodule.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall MyObject::qt_metacast(char const *)" (?qt_metacast@MyObject@@UAEPAXPBD@Z)
  7. clientmodule.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall MyObject::qt_metacall(enumQMetaObject::Call,int,void * *)" (?qt_metacall@MyObject@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
  8. ..\bin\mylib.dll : fatal error LNK1120: 4 unresolved externals
  9. NMAKE : fatal error U1077: 'C:\vs9\VC\BIN\link.EXE' : return code '0x460'
  10. Stop.
  11. NMAKE : fatal error U1077: 'C:\vs9\VC\BIN\nmake.exe' : return code '0x2'
  12. Stop.
  13. NMAKE : fatal error U1077: 'cd' : return code '0x2'
  14. Stop.
To copy to clipboard, switch view to plain text mode 

The reason is that when i compile my second library it includes the headers from the first library but the macro wants to export instead of import the classes. This seems to only happen with QObject classes but i could be wrong.

So in the second library write a new macro with a DIFFERENT name. I sure hope this helps you.