[total n00b]QGLWidgets keeps giving LNK2001 error in visual studio 2013??



  • sorry if my question is too noobish ,but really i have tried almost everything, my main point was to get some opengl code running in visual studio and study of "opengl programming guide" , i am trying for 2nd day now, with no luck....

    i have everything set up ,added the include folder , the lib folder also copied the bin folder to the debug folder , i ran an empty QApplication and it worked , now i don't know why this doesn't work

    My main:
    @

    #include"QtWidgets\qapplication.h"
    #include"Screen.h"

    int main(int argc, char* argv[]){
    QApplication app(argc, argv);
    Screen s;
    s.show();
    return app.exec();
    }
    @

    The Screen class header , screen.cpp is empty:
    @
    #pragma once
    #ifndef SCREEN
    #define SCREEN
    #include <QtOpenGL\qglWidget>
    class Screen : public QGLWidget
    {
    public:
    void initializeGL();
    void paintGL();
    };
    #endif
    @

    i just want to show the opengl window , and apparently i cant even do that

    here is a LNK error
    @
    Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QGLWidget::QGLWidget(class QWidget *,class QGLWidget const *,class QFlags<enum Qt::WindowType>)" (_imp??0QGLWidget@@QEAA@PEAVQWidget@@PEBV0@V?$QFlags@W4WindowType@Qt@@@@@Z) referenced in function "public: __cdecl Screen::Screen(void)" (??0Screen@@QEAA@XZ) D:\OpenGL\c++\firstOpen\tmain.obj firstOpen
    @
    it is basically 25 of those!!


  • Moderators

    Hi, welcome to devnet.

    OpenGL support is a separate module in Qt. You need to tell linker where to look for it.
    Add this to your .pro file:
    @
    QT += opengl
    @

    Edit: Oh, and re-run qmake after that.


Log in to reply
 

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