[Solved] Writing Qt3D application in windows



  • I am going to write Qt3D application in windows. I have also installed necessary tools , but after compilation i receive 'unresolved external symbol' error. what is the solution?

    Note : compiler is microsoft visual c++ 9.0 , Qt version is 4.8.1 and I have installed "Qt3D binary package":http://labs.qt.nokia.com/2012/04/11/qt-3d-and-qt5-qt4-news-and-releases/.


  • Moderators

    Which external symbol is unresolved? That's the key.



  • These are two external symbol errors :
    1.viewer.obj:: error: unresolved external symbol __imp__glClearColor@16 referenced in function "private: virtual void __thiscall Viewer::initializeGL(class QGLPainter *)" (?initializeGL@Viewer@@EAEXPAVQGLPainter@@@Z)

    2.viewer.obj:: error: unresolved external symbol __imp__glClear@4 referenced in function "private: virtual void __thiscall Viewer::paintGL(class QGLPainter *)" (?paintGL@Viewer@@EAEXPAVQGLPainter@@@Z)



  • Adding
    @
    LIBS += -lOpengl32
    @
    in your application project file ?
    Or if you use VC IDE, append Opengl32.lib in additional linker libraries list.



  • this is my project file contents :
    @
    SOURCES +=
    main.cpp
    viewer.cpp

    LIBS += C:\Qt\4.8.1\lib\QtOpenGL4.lib
    C:\Qt\4.8.1\lib\Qt3D.lib \

    HEADERS +=
    viewer.h@

    before adding 'OpenGL32' compilation result is two external symbol error. after adding OpenGL32 compilation done successfully but application crashes. in fact i receive this error :
    The procedure entry point ??4QImage@@AEAAV0@$$QAV0@@Z could not be found in the dynamic link library QtGui4.dll



  • I think it need additional explanations. the entry point error occurs when i link the program against OpenGL32 library. in other conditions such in this piece of code :

    @#include <QApplication>
    #include <QLabel>

    int main(int argc,char **argv)
    {
    QApplication app(argc,argv);
    QLabel *lbl = new QLabel;
    lbl->setText(QString("<h1>%1</h1>").arg(QT_VERSION_STR));
    lbl->show();
    return app.exec();
    }@

    program works properly and there is no trouble with QtGui4.



  • Problem solved. I compiled Qt3D from source.


Log in to reply
 

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