Add Qt Class to existing old Visual Studio 2017 project



  • Hello all,
    I'm trying to replace a GUI in an old visual studio project.

    After install the Qt visual studio tools, and convert the old project to Qt VS Tools Project, I added a new Qt Class, simply to test that the new enviroment compile without problems. I'm thinking in replace that class with my gui after.

    but to begining, the new class don't fit with the old project,; I obtainthe linker errors below.

    I readed alle threads that I found, but can I not get it.

    please, any help will be wellcomed.

    1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\um\winsock2.h(17): warning C4005: '_WINSOCKAPI_': macro redefinition (compiling source file ..\erpc-1.7.1\erpc_c\transports\erpc_tcp_transport_win.cpp)
    1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\um\winsock2.h(17): note: command-line arguments:  see previous definition of '_WINSOCKAPI_' (compiling source file ..\erpc-1.7.1\erpc_c\transports\erpc_tcp_transport_win.cpp)
    1>d:\hmisg\hmisg_app\erpc-1.7.1\erpc_c\transports\erpc_tcp_transport_win.cpp(58): warning C4067: unexpected tokens following preprocessor directive - expected a newline
    1>d:\hmisg\hmisg_app\erpc-1.7.1\erpc_c\transports\erpc_tcp_transport_win.cpp(148): warning C4715: 'erpc::TCPTransport::open': not all control paths return a value
    1>qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl qt_assert(char const *,char const *,int)" (__imp_?qt_assert@@YAXPBD0H@Z) referenced in function "public: struct QTypedArrayData<unsigned short> * __thiscall QStaticStringData<10>::data_ptr(void)const " (?data_ptr@?$QStaticStringData@$09@@QBEPAU?$QTypedArrayData@G@@XZ)
    1>qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl QMetaObject::connectSlotsByName(class QObject *)" (__imp_?connectSlotsByName@QMetaObject@@SAXPAVQObject@@@Z) referenced in function "public: void __thiscall Ui_QtGuiClass::setupUi(class QWidget *)" (?setupUi@Ui_QtGuiClass@@QAEXPAVQWidget@@@Z)
    1>qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QString::QString(class QString const &)" (__imp_??0QString@@QAE@ABV0@@Z) referenced in function "public: class QString __thiscall <lambda_e88a9bf938f49f0ca350a5d2b1dbca51>::operator()(void)const " (??R<lambda_e88a9bf938f49f0ca350a5d2b1dbca51>@@QBE?AVQString@@XZ)
    1>qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QString::~QString(void)" (__imp_??1QString@@QAE@XZ) referenced in function "public: class QString __thiscall <lambda_e88a9bf938f49f0ca350a5d2b1dbca51>::operator()(void)const " (??R<lambda_e88a9bf938f49f0ca350a5d2b1dbca51>@@QBE?AVQString@@XZ)
    1>qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall QString::isEmpty(void)const " (__imp_?isEmpty@QString@@QBE_NXZ) referenced in function "public: void __thiscall Ui_QtGuiClass::setupUi(class QWidget *)" (?setupUi@Ui_QtGuiClass@@QAEXPAVQWidget@@@Z)
    1>qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QString::QString(struct QStringDataPtr)" (__imp_??0QString@@QAE@UQStringDataPtr@@@Z) referenced in function "public: class QString __thiscall <lambda_e88a9bf938f49f0ca350a5d2b1dbca51>::operator()(void)const " (??R<lambda_e88a9bf938f49f0ca350a5d2b1dbca51>@@QBE?AVQString@@XZ)
    1>qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class QString __thiscall QObject::objectName(void)const " (__imp_?objectName@QObject@@QBE?AVQString@@XZ) referenced in function "public: void __thiscall Ui_QtGuiClass::setupUi(class QWidget *)" (?setupUi@Ui_QtGuiClass@@QAEXPAVQWidget@@@Z)
    1>qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QObject::setObjectName(class QString const &)" (__imp_?setObjectName@QObject@@QAEXABVQString@@@Z) referenced in function "public: void __thiscall Ui_QtGuiClass::setupUi(class QWidget *)" (?setupUi@Ui_QtGuiClass@@QAEXPAVQWidget@@@Z)
    1>qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QWidget::QWidget(class QWidget *,class QFlags<enum Qt::WindowType>)" (__imp_??0QWidget@@QAE@PAV0@V?$QFlags@W4WindowType@Qt@@@@@Z) referenced in function "public: __thiscall QtGuiClass::QtGuiClass(class QWidget *)" (??0QtGuiClass@@QAE@PAVQWidget@@@Z)
    1>qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QWidget::~QWidget(void)" (__imp_??1QWidget@@UAE@XZ) referenced in function __unwindfunclet$??0QtGuiClass@@QAE@PAVQWidget@@@Z$0
    1>qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWidget::setWindowTitle(class QString const &)" (__imp_?setWindowTitle@QWidget@@QAEXABVQString@@@Z) referenced in function "public: void __thiscall Ui_QtGuiClass::retranslateUi(class QWidget *)" (?retranslateUi@Ui_QtGuiClass@@QAEXPAVQWidget@@@Z)
    1>qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWidget::resize(int,int)" (__imp_?resize@QWidget@@QAEXHH@Z) referenced in function "public: void __thiscall Ui_QtGuiClass::setupUi(class QWidget *)" (?setupUi@Ui_QtGuiClass@@QAEXPAVQWidget@@@Z)
    1>qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class QString __cdecl QCoreApplication::translate(char const *,char const *,char const *,int)" (__imp_?translate@QCoreApplication@@SA?AVQString@@PBD00H@Z) referenced in function "public: void __thiscall Ui_QtGuiClass::retranslateUi(class QWidget *)" (?retranslateUi@Ui_QtGuiClass@@QAEXPAVQWidget@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::actionEvent(class QActionEvent *)" (?actionEvent@QWidget@@MAEXPAVQActionEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::changeEvent(class QEvent *)" (?changeEvent@QWidget@@MAEXPAVQEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QObject::childEvent(class QChildEvent *)" (?childEvent@QObject@@MAEXPAVQChildEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::closeEvent(class QCloseEvent *)" (?closeEvent@QWidget@@MAEXPAVQCloseEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QObject::connectNotify(class QMetaMethod const &)" (?connectNotify@QObject@@MAEXABVQMetaMethod@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::contextMenuEvent(class QContextMenuEvent *)" (?contextMenuEvent@QWidget@@MAEXPAVQContextMenuEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QObject::customEvent(class QEvent *)" (?customEvent@QObject@@MAEXPAVQEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall QWidget::devType(void)const " (?devType@QWidget@@UBEHXZ)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QObject::disconnectNotify(class QMetaMethod const &)" (?disconnectNotify@QObject@@MAEXABVQMetaMethod@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::dragEnterEvent(class QDragEnterEvent *)" (?dragEnterEvent@QWidget@@MAEXPAVQDragEnterEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::dragLeaveEvent(class QDragLeaveEvent *)" (?dragLeaveEvent@QWidget@@MAEXPAVQDragLeaveEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::dragMoveEvent(class QDragMoveEvent *)" (?dragMoveEvent@QWidget@@MAEXPAVQDragMoveEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::dropEvent(class QDropEvent *)" (?dropEvent@QWidget@@MAEXPAVQDropEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::enterEvent(class QEvent *)" (?enterEvent@QWidget@@MAEXPAVQEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall QWidget::event(class QEvent *)" (?event@QWidget@@MAE_NPAVQEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QObject::eventFilter(class QObject *,class QEvent *)" (?eventFilter@QObject@@UAE_NPAV1@PAVQEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::focusInEvent(class QFocusEvent *)" (?focusInEvent@QWidget@@MAEXPAVQFocusEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall QWidget::focusNextPrevChild(bool)" (?focusNextPrevChild@QWidget@@MAE_N_N@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::focusOutEvent(class QFocusEvent *)" (?focusOutEvent@QWidget@@MAEXPAVQFocusEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QWidget::hasHeightForWidth(void)const " (?hasHeightForWidth@QWidget@@UBE_NXZ)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall QWidget::heightForWidth(int)const " (?heightForWidth@QWidget@@UBEHH@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::hideEvent(class QHideEvent *)" (?hideEvent@QWidget@@MAEXPAVQHideEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::initPainter(class QPainter *)const " (?initPainter@QWidget@@MBEXPAVQPainter@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::inputMethodEvent(class QInputMethodEvent *)" (?inputMethodEvent@QWidget@@MAEXPAVQInputMethodEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QWidget::inputMethodQuery(enum Qt::InputMethodQuery)const " (?inputMethodQuery@QWidget@@UBE?AVQVariant@@W4InputMethodQuery@Qt@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::keyPressEvent(class QKeyEvent *)" (?keyPressEvent@QWidget@@MAEXPAVQKeyEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::keyReleaseEvent(class QKeyEvent *)" (?keyReleaseEvent@QWidget@@MAEXPAVQKeyEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::leaveEvent(class QEvent *)" (?leaveEvent@QWidget@@MAEXPAVQEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall QWidget::metric(enum QPaintDevice::PaintDeviceMetric)const " (?metric@QWidget@@MBEHW4PaintDeviceMetric@QPaintDevice@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "public: virtual class QSize __thiscall QWidget::minimumSizeHint(void)const " (?minimumSizeHint@QWidget@@UBE?AVQSize@@XZ)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::mouseDoubleClickEvent(class QMouseEvent *)" (?mouseDoubleClickEvent@QWidget@@MAEXPAVQMouseEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::mouseMoveEvent(class QMouseEvent *)" (?mouseMoveEvent@QWidget@@MAEXPAVQMouseEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::mousePressEvent(class QMouseEvent *)" (?mousePressEvent@QWidget@@MAEXPAVQMouseEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::mouseReleaseEvent(class QMouseEvent *)" (?mouseReleaseEvent@QWidget@@MAEXPAVQMouseEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::moveEvent(class QMoveEvent *)" (?moveEvent@QWidget@@MAEXPAVQMoveEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall QWidget::nativeEvent(class QByteArray const &,void *,long *)" (?nativeEvent@QWidget@@MAE_NABVQByteArray@@PAXPAJ@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "public: virtual class QPaintEngine * __thiscall QWidget::paintEngine(void)const " (?paintEngine@QWidget@@UBEPAVQPaintEngine@@XZ)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::paintEvent(class QPaintEvent *)" (?paintEvent@QWidget@@MAEXPAVQPaintEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual class QPaintDevice * __thiscall QWidget::redirected(class QPoint *)const " (?redirected@QWidget@@MBEPAVQPaintDevice@@PAVQPoint@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::resizeEvent(class QResizeEvent *)" (?resizeEvent@QWidget@@MAEXPAVQResizeEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QWidget::setVisible(bool)" (?setVisible@QWidget@@UAEX_N@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual class QPainter * __thiscall QWidget::sharedPainter(void)const " (?sharedPainter@QWidget@@MBEPAVQPainter@@XZ)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::showEvent(class QShowEvent *)" (?showEvent@QWidget@@MAEXPAVQShowEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "public: virtual class QSize __thiscall QWidget::sizeHint(void)const " (?sizeHint@QWidget@@UBE?AVQSize@@XZ)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::tabletEvent(class QTabletEvent *)" (?tabletEvent@QWidget@@MAEXPAVQTabletEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QObject::timerEvent(class QTimerEvent *)" (?timerEvent@QObject@@MAEXPAVQTimerEvent@@@Z)
    1>qtguiclass.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWidget::wheelEvent(class QWheelEvent *)" (?wheelEvent@QWidget@@MAEXPAVQWheelEvent@@@Z)
    1>moc_qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ) referenced in function "public: virtual struct QMetaObject const * __thiscall QtGuiClass::metaObject(void)const " (?metaObject@QtGuiClass@@UBEPBUQMetaObject@@XZ)
    1>moc_qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QWidget::qt_metacast(char const *)" (__imp_?qt_metacast@QWidget@@UAEPAXPBD@Z) referenced in function "public: virtual void * __thiscall QtGuiClass::qt_metacast(char const *)" (?qt_metacast@QtGuiClass@@UAEPAXPBD@Z)
    1>moc_qtguiclass.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual int __thiscall QWidget::qt_metacall(enum QMetaObject::Call,int,void * *)" (__imp_?qt_metacall@QWidget@@UAEHW4Call@QMetaObject@@HPAPAX@Z) referenced in function "public: virtual int __thiscall QtGuiClass::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QtGuiClass@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
    1>moc_qtguiclass.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static struct QMetaObject const QWidget::staticMetaObject" (__imp_?staticMetaObject@QWidget@@2UQMetaObject@@B)
    1>D:\HMISG\HMISG_App\Win32\Debug\HMISG_App.exe : fatal error LNK1120: 64 unresolved externals
    

  • Moderators

    When you use Qt classes you must also link against the Qt libraries.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.