Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QGLWidget error



  • hai all,
    I'm completely new to Qt
    Iwant a QGLWidget in my project,
    so I added the following code:
    @GLWidget *openGL ;
    openGL=new GLWidget(this);@
    When I compiled this I got the following error:
    fatal error C1083: Cannot open include file: 'QGLWidget': No such file or directory
    Can anybody help me with this?



  • Perhaps you forgot to add @QT += opengl@ to your .pro file?



  • I've added it,but no change.It's the same error


  • Moderators

    Does it work if you use @#include <QtOpenGL/QGLWidget>@ instead of just @#include <QGLWidget>@ ?



  • [quote author="mlong" date="1329495288"]Does it work if you use @#include <QtOpenGL/QGLWidget>@ instead of just @#include <QGLWidget>@ ?[/quote]

    What's the difference between this declarations?

    BR,



  • Hai all,thanks for the reply.
    It was due to the missing of include file ,
    so I added the following in my include
    ..\Qt\4.8.0\include\QtOpenGL
    and the foll: line in my C/C++->Preprocessor
    QT_OPENGL_LIB
    and the foll: line in my Linker->Input
    c:\Qt\4.8.0\lib\QtOpenGLd4.lib
    and I got it working.



  • I am newbie.
    Which file(s) should I edit to add those lines as sruthy suggested?
    Thanks in advance.


Log in to reply