Solved Qt library link errors under Windows
-
Project builds just fine in Linux, however fails to link under Windows.
1st issue (solved)
Solved here: https://stackoverflow.com/q/50064670/630169
2nd issue:
In the library
.pro
fileVERSION
variable is defined and resulting library has nameMyLibrary1.lib
. Thereafter I get error::-1: error: LNK1181: cannot open input file 'MyLibrary.lib'
What is better way to solve the problem here: remove
VERSION
or fix.pro
file? How?
3rd issue:
Another link error:
mydialog.obj:-1: error: LNK2001: unresolved external symbol "struct QMetaObject const MyLibrary::staticMetaObject" (?staticMetaObject@MyLibrary@@3UQMetaObject@@B)
Error happen because of the following line in code (disappears when commented out):
mydialog.cpp:
QMetaEnum myEnum = QMetaEnum::fromType<MyLibrary::MyEnumClass>();
mylibrary.h:
namespace MyLibrary { Q_NAMESPACE enum class MYLIBRARYSHARED_EXPORT MyEnumClass { ... }; Q_ENUM_NS(MyEnumClass) ... } // namespace MyLibrary
And how to solve the 3rd one?
-
Solution is here: https://stackoverflow.com/a/50064976/630169
-
Solution is here: https://stackoverflow.com/a/50064976/630169