[SOLVED] Build failure : undefined reference to `gluPerspective'
-
Hello everbody,
I have a build error when I try to build my Qt project with QtCreator. "undefined reference to `gluPerspective'".
My .pro file is :@SOURCES +=
main.cpp
monwidgetopengl.cpp
mafenetre.cppHEADERS +=
monwidgetopengl.h
mafenetre.h
QT+= opengl
QT+= widgets@My mafenetre.cpp file (the error comes from this file):
@#include "mafenetre.h"
#include <GL/glu.h>// ...
// ...
void MaFenetre::resizeGL(int width, int height)
{
//...
gluPerspective(45.0f, (GLfloat)width/(GLfloat)height, 0.1f, 100.0f);
//...}@
I don't understand why I have this error when I try to build my project. I have included the <GL/glu.h>, link opengl lib to my project...
If someone has an idea...
Thanks! -
Hi,
You need to provide more information: What OS ? What compiler ? What Qt version ?
-
IIRC gluPerspective comes from the glut (freeglut ?) library. Are you linking against the glut library ?
-
Including glu.h has nothing to do with linking the library. Did you check that your program is linked with glut ?
What version of OpenGL are you using ? IIRC gluPerspective has been removed since OpenGL 3.0.
You can also find an implementation called qgluPerspective in the Boxes example
-
I know for the gluPerspective removal since OpenGL 3.x. It's the OpenGL's version I have but as I said glPerspective works with another project with the SDL Library (and same compiler, OpenGL 3.x...) ; that's weird I know... if the glPerspective has been removed...
I'm going to check if my QtCreator is linked with glut ASAP... but it's GLU, not GLUT, I think. If it was GLUT my function should be glutPerspective, no?@john_god, what's the difference between this function and gluPerspective?
-
It's GLUT (GLUT stands for OpenGL Utility Toolkit)
gluPerspective does some mathematic for you and then uses glFrustrum. Either search for the implementation on google, or grep qgluPerspective in your Qt 5 sources.
-
[quote author="Zikkee13" date="1365005409"]@john_god, what's the difference between this function and gluPerspective?[/quote]
I'm too lazy to check the specs right now but I think they are the same, the diference is that gluPerspective adds GLUT dependency to your project, glFrustum() is OpenGL native.
Go check it out on google :)Edit: Ok I just check them, they are no the same, please check glOrtho(). Basically all this functions do is to setup diferent math perspectives / projections to your world.
-
Hello, I have same problem compiling a project in qt5,
@ undefined reference to gluPerspective@
@undefined reference to gluLookAt@i'm on Debian Wheezy 64bit ..