I am trying to use OpenGL with Qt.
I was following this example: http://qt-project.org/doc/qt-5.0/qtgui/openglwindow.html using Qt 5 build for msvc2012. In the end I am getting the following errors:
- error LNK2019: unresolved external symbol _imp_glClear@4 referenced in function "public: virtual void __thiscall OpenGLWindow::render(void)" (?render@OpenGLWindow@@UAEXXZ) D:\Documents\Code\Qt Projects\qttest2\qttest2\openglwindow.obj qttest2
- error LNK2001: unresolved external symbol _imp_glClear@4 D:\Documents\Code\Qt Projects\qttest2\qttest2\trianglewindow.obj qttest2
- error LNK2019: unresolved external symbol _imp_glDrawArrays@12 referenced in function "public: virtual void __thiscall TriangleWindow::render(void)" (?render@TriangleWindow@@UAEXXZ) D:\Documents\Code\Qt Projects\qttest2\qttest2\trianglewindow.obj qttest2
- error LNK2019: unresolved external symbol _imp_glViewport@16 referenced in function "public: virtual void __thiscall TriangleWindow::render(void)" (?render@TriangleWindow@@UAEXXZ) D:\Documents\Code\Qt Projects\qttest2\qttest2\trianglewindow.obj qttest2
- error LNK1120: 3 unresolved externals D:\Documents\Code\Qt Projects\qttest2\Win32\Debug\qttest2.exe qttest2
I can see that it has to do with the linking of OpenGL functions but I don't have much knowledge about linking.
I get the errors even if I copy the source code in from the OpenGLWindow example.
datenwolf :
You must add opengl32.lib to the list of linked libraries. Adding the OpenGL module in the QtCreator .pro file should do the trick\n\nQT += opengl\n",
2013-02-03T22:32:42
user362638 :
Have you added the OpenGL module in your pro file like this:\n\nQT += opengl\n",
2013-02-03T22:22:23
zh_ :
If you use Qt 5, then add next lib in you project file (*.pro)\n\nLIBS += -LD:\\Qt\\5.5\\mingw492_32\\lib\\libQt5OpenGL.a -lopengl32\n\n\nD:\\Qt\\5.5\\mingw492_32\\lib\\libQt5OpenGL.a is path.",
2016-03-31T11:59:33