Reputation: 1787
I am getting error on commands related to glu such as gluPerspective and gluLookAt when compiling. I am including in *.pro file:
QT += core gui opengl widgets declarative
LIBS += -lOpengl32
TARGET = test
TEMPLATE = app
TEMPLATE = lib
SOURCES += main.cpp\
mainwindow.cpp \
glwidget.cpp
HEADERS += mainwindow.h \
glwidget.h
FORMS += mainwindow.ui
DISTFILES += \
freeglut.dll \
glew32.dll
in the glwidget.h:
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QtOpenGL/QGLWidget>
#include <GL/GLU.h>
#include <QTimer>
class GLWidget : public QGLWidget {
Q_OBJECT
public:
//! CONSTRUCTOR
GLWidget(QWidget *parent = 0);
//! DESTRUCTOR
~GLWidget();
protected:
/// OPENGL
void initializeGL();
void paintGL();
};
#endif // GLWIDGET_H
glwidget.cpp:
void GLWidget::paintGL() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective( 60.0, 1.0, 0.5, 10.0 );
gluLookAt( 0.0, -1.8, 5.0, 0.0, -2.7, 0.0, 0.0, 1.0, 0.0 );
}
When getting the gluPerspective
and gluLookAt
, I am getting the error: undefined reference to 'gluPerspective@32' and undefined reference to 'gluLookAT@72'. Do you know what I am missing in the configuration to use the glu library?
Upvotes: 1
Views: 3966
Reputation: 5801
I think you may need to add:
LIBS += -lglut -lGLU
to your .pro file since gluPerspective
comes from GLUT module.
Upvotes: 2