Can't build OpenGL test code
-
wrote on 31 Mar 2016, 10:19 last edited by Zholaman
Hi, please help.
Every time when I build the source code I get the following errors:
- D:\c++_project\build-OGLQuad-Desktop_Qt_5_5_1_MinGW_32bit-Debug\debug\OGLQuad.o:-1: In function `ZN7OGLQuad8resizeGLEii':
- D:\c++_project\test9\OGLQuad.cpp:37: error: undefined reference to `_imp__glMatrixMode@4'
- D:\c++_project\test9\OGLQuad.cpp:38: error: undefined reference to `_imp__glLoadIdentity@0'
- D:\c++_project\test9\OGLQuad.cpp:39: error: undefined reference to `_imp__glViewport@16'
- D:\c++_project\test9\OGLQuad.cpp:40: error: undefined reference to `_imp__glOrtho@48'
- D:\c++_project\test9\OGLQuad.cpp:46: error: undefined reference to `_imp__glClear@4'
- D:\c++_project\test9\OGLQuad.cpp:48: error: undefined reference to `_imp__glBegin@4'
etc
I use Qt 5.5.1, Qt Creator 3.6, MinGW 4.9.3 (32bit)
My environment:
OS Windows 7, 64bit.Source code of my project:
pro file.
TEMPLATE = app
QT += widgets opengl core gui
HEADERS = OGLQuad.h
SOURCES = OGLQuad.cpp
main.cpp
windows:TARGET = ../OGLQuadThanks
-
Hi, please help.
Every time when I build the source code I get the following errors:
- D:\c++_project\build-OGLQuad-Desktop_Qt_5_5_1_MinGW_32bit-Debug\debug\OGLQuad.o:-1: In function `ZN7OGLQuad8resizeGLEii':
- D:\c++_project\test9\OGLQuad.cpp:37: error: undefined reference to `_imp__glMatrixMode@4'
- D:\c++_project\test9\OGLQuad.cpp:38: error: undefined reference to `_imp__glLoadIdentity@0'
- D:\c++_project\test9\OGLQuad.cpp:39: error: undefined reference to `_imp__glViewport@16'
- D:\c++_project\test9\OGLQuad.cpp:40: error: undefined reference to `_imp__glOrtho@48'
- D:\c++_project\test9\OGLQuad.cpp:46: error: undefined reference to `_imp__glClear@4'
- D:\c++_project\test9\OGLQuad.cpp:48: error: undefined reference to `_imp__glBegin@4'
etc
I use Qt 5.5.1, Qt Creator 3.6, MinGW 4.9.3 (32bit)
My environment:
OS Windows 7, 64bit.Source code of my project:
pro file.
TEMPLATE = app
QT += widgets opengl core gui
HEADERS = OGLQuad.h
SOURCES = OGLQuad.cpp
main.cpp
windows:TARGET = ../OGLQuadThanks
wrote on 31 Mar 2016, 11:46 last edited by@Zholaman For those who faced with this problem.
I have resolved it by adding the following lib in my pro file:
LIBS += -LD:\Qt\5.5\mingw492_32\lib\libQt5OpenGL.a -lopengl32
The D:\Qt\5.5\mingw492_32\lib\libQt5OpenGL.a is path to lib file (libQt5OpenGL.a)
-
Lifetime Qt Championwrote on 1 Apr 2016, 04:37 last edited by jsulm 4 Jan 2016, 04:38
-LD:\Qt\5.5\mingw492_32\lib\libQt5OpenGL.a - is wrong.
-L option is used to specify directories where the linker should look for libraries. You're specifying a file.
It should not be required to specify the path to libQt5OpenGL.a as it is part of Qt - QT += opengl should be enough.
The errors you get are not related to libQt5OpenGL.a, I think they are related to missing opengl32. So, adding -lopengl32 should be sufficient.
1/3