[Interest] [Development] Qt library link errors under Windows

Thiago Macieira thiago.macieira at intel.com
Fri Apr 27 21:17:59 CEST 2018


Hello Aleksey

None of your questions looks like problems in Qt itself, so I've taken the 
liberty of replying to the interest mailing list (discussion about *using* 
Qt).

On Friday, 27 April 2018 10:11:52 PDT Aleksey Kontsevich wrote:
> mydialog.obj:-1: error: LNK2001: unresolved external symbol
> "struct QMetaObject const MyLibrary::staticMetaObject"
> (?staticMetaObject at MyLibrary@@3UQMetaObject@@B)

Make sure that:

1) class MyLibrary is in a header file
2) that header file is listed in the library's .pro file HEADERS line
3) moc was run in the header and the resulting output was compiled
4) your definition contains an export macro:

  class MY_LIBRARY_EXPORT MyLibrary : ....

5) said macro is __declspec(dllexport) when compiling the library and 
__declspec(dllimport) when linking the library.  This is "Windows DLL Basics" 
and you need to learn it.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center






More information about the Interest mailing list