[Development] Qt library link errors under Windows
tantrido at ya.ru
Fri Apr 27 22:19:38 CEST 2018
Of course all these 1-5 points are followed as You can see visiting 1st mentioned link:
Please take a look at the line which causes the link problem:
QMetaEnum myEnum = QMetaEnum::fromType<MyLibrary::MyEnumClass>();
It happen only for combination: Q_NAMESPACE, Q_ENUM_NS(MyEnumClass), build under Windows.
You may try it to build yourself under Windows to see the problem:
Linked in https://www.linkedin.com/in/alekseykontsevich
27.04.2018, 21:18, "Thiago Macieira" <thiago.macieira at intel.com>:
> 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*
> 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 Development