[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/.
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)
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 :
LIBS += C:\Qt\4.8.1\lib\QtOpenGL4.lib
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 :
int main(int argc,char **argv)
QLabel *lbl = new QLabel;
program works properly and there is no trouble with QtGui4.
Problem solved. I compiled Qt3D from source.