问题
In an earlier question, I was trying to create a QSpinBox64
class. After following the hints from the answer, the code worked on linux.
However, when building on Windows, a number of errors occur:
moc_qspinbox64.obj:-1: error: LNK2001: unresolved external symbol "public: static struct QMetaObject const QAbstractSpinBox::staticMetaObject" (?staticMetaObject@QAbstractSpinBox@@2UQMetaObject@@B)
moc_qspinbox64.obj:-1: error: LNK2019: unresolved external symbol "public: static struct QMetaObject const QWidget::staticMetaObject" (?staticMetaObject@QWidget@@2UQMetaObject@@B) referenced in function "public: static class QString __cdecl QWidget::tr(char const *,char const *,int)" (?tr@QWidget@@SA?AVQString@@PEBD0H@Z)
moc_qspinbox64.obj:-1: error: LNK2019: unresolved external symbol "public: static struct QMetaObject const QAbstractButton::staticMetaObject" (?staticMetaObject@QAbstractButton@@2UQMetaObject@@B) referenced in function "public: static class QString __cdecl QAbstractButton::tr(char const *,char const *,int)" (?tr@QAbstractButton@@SA?AVQString@@PEBD0H@Z)
There are a lot of errors of this type.
Environment settings related to the QT:
- QTDIR C:\Qt\5.15.2\msvc2019_64
- QTJAVA C:\Program Files (x86)\QuickTime\QTSystem\QTJava.zip
- QtMsBuild C:\Users\Yota\AppData\Local\QtMsBuild
QT under Windows I installed from the official website
How to avoid these errors when building under Windows?
来源:https://stackoverflow.com/questions/65704129/qspinbox64-build-for-windows