PDA

View Full Version : OpenGL: undefined references



PoetikBiker
05-27-2016, 05:14 AM
Hello,

I want to develop a program with OpenGL. I use Eclipse, MinGW64 and the Qt-library 5.4

this is the structure of the program:




#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include "GL/glext.h"
#include <QtGui/qopengl.h>
...

void AppView::OnDraw3D()
{
GLuint vertexShader;
...
// Clear the colorbuffer
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
...
GLuint VBO;
glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);

glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
...


I can compile the code without any Problems, but the linker says:



C:\qWork\qCad\Debug/../DocView/appView.cpp:181: undefined reference to `glGenBuffers'
C:\qWork\qCad\Debug/../DocView/appView.cpp:182: undefined reference to `glBindBuffer'
C:\qWork\qCad\Debug/../DocView/appView.cpp:184: undefined reference to `glBufferData'
C:\qWork\qCad\Debug/../DocView/appView.cpp:187: undefined reference to `glCreateShader'
C:\qWork\qCad\Debug/../DocView/appView.cpp:188: undefined reference to `glShaderSource'
C:\qWork\qCad\Debug/../DocView/appView.cpp:189: undefined reference to `glCompileShader'


the linker is called with:



g++ ... -lqLibD -lQt5Widgetsd -lqtmaind -lqwindowsd -lwinspool -lshlwapi -lQt5PlatformSupportd -lcomdlg32 -lQt5Guid -loleaut32 -limm32 -lwinmm -lQt5OpenGLd -lQt5OpenGLExtensions -lglu32 -lopengl32 -lglew32 -lgdi32 -lqtharfbuzzngd -lQt5Cored -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmpr -lz


Espacially I link against Qt5OpenGLd, Qt5OpenGLExtensions, glu32, opengl32 glew32 und gdi32


Obviously there is something missing or the order of the libraries are wrong???
I tried several orders, but without any success.

Can anybody help me please?

Thanks and regards