QT5 Linker error for VS2012 [SOLVED]



  • I'm using Visaul studio 2012 with QT5 SDK and qt-VS add-on 1.2.1 and trying to build the qt Application. I've included dependent libs to compile but i'm getting linker error like this

    main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall QApplication::QApplication(int &,char * *,int)" (_imp??0QApplication@@QAE@AAHPAPADH@Z)
    1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QApplication::~QApplication(void)" (_imp??1QApplication@@UAE@XZ)
    1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static int __cdecl QApplication::exec(void)" (_imp?exec@QApplication@@SAHXZ)
    1>mainwindow.obj : error LNK2001: 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)
    1>mainwindow.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QWidget::~QWidget(void)" (_imp??1QWidget@@UAE@XZ)
    1>mainwindow.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWidget::setWindowTitle(class QString const &)" (_imp?setWindowTitle@QWidget@@QAEXABVQString@@@Z)
    1>mainwindow.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWidget::resize(class QSize const &)" (_imp?resize@QWidget@@QAEXABVQSize@@@Z)
    1>mainwindow.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall QMainWindow::QMainWindow(class QWidget *,class QFlags<enum Qt::WindowType>)" (_imp??0QMainWindow@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
    1>mainwindow.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QMainWindow::~QMainWindow(void)" (_imp??1QMainWindow@@UAE@XZ)
    1>mainwindow.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall QMainWindow::setMenuBar(class QMenuBar *)" (_imp?setMenuBar@QMainWindow@@QAEXPAVQMenuBar@@@Z)
    1>mainwindow.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall QMainWindow::setStatusBar(class QStatusBar *)" (_imp?setStatusBar@QMainWindow@@QAEXPAVQStatusBar@@@Z)

    What dependant libraries i'm missing here. please help me


  • Lifetime Qt Champion

    Hi,

    Does your pro file include a line like
    @
    QT += widgets
    @

    ?



  • yeah. I was missing that. thanks that solved my problem


Log in to reply
 

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