You are not logged in.
I am going through the opengl tutorials on http://www.videotutorialsrock.com/ and have
a problem similar to that mentioned in an old posting:
http://bbs.archlinux.org/viewtopic.php? … 65#p709765
I am having a similar compile problem with gluPerspective.
Any ideas anyone? The error is:
[dwende@AMD cube]$ make
g++ -Wall -o cube main.cpp imageloader.cpp -lglut -lGL
imageloader.cpp: In function 'Image* loadBMP(const char*)':
imageloader.cpp:141: warning: suggest parentheses around '&&' within '||'
/tmp/ccTcVEcJ.o: In function `handleResize(int, int)':
main.cpp:(.text+0x183): undefined reference to `gluPerspective'
collect2: ld returned 1 exit status
make: *** [cube] Error 1
[dwende@AMD cube]$
I have freeglut installed as seen here:
[dwende@AMD cube]$ pacman -Qi freeglut
Name : freeglut
Version : 2.6.0-1
URL : http://freeglut.sourceforge.net/
Licenses : MIT
Groups : None
Provides : glut
Depends On : libxxf86vm mesa libxi
Optional Deps : None
Required By : gtkglarea jasper swftools
Conflicts With : glut
Replaces : glut
Installed Size : 720.00 K
Packager : Eric Belanger <eric@archlinux.org>
Architecture : i686
Build Date : Thu 31 Dec 2009 01:08:51 AM IST
Install Date : Tue 16 Feb 2010 05:05:31 AM IST
Install Reason : Installed as a dependency for another package
Install Script : No
Description : Provides functionality for small OpenGL programs
The first part of main.cpp is:
#include <iostream>
#include <stdlib.h>
#ifdef __APPLE__
#include <OpenGL/OpenGL.h>
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
#include "imageloader.h"
Thanks
Offline
gluPerspective was apparently deprecated in OpenGL 3.0, and removed in 3.1 - is that why you see a problem?
glxinfo | grep "version string"
The OpenGL wiki article here might help.
Offline
Did you link against glu?
Edit: I just re-read your post and saw that you don't Try adding '-lglu' to
your compiler call.
Last edited by the_isz (2010-02-16 13:40:47)
Offline
I'm having a similar problem (can't find gluPerspective or gluLookAt):
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
When I try to compile with -lglu, I get:
/usr/bin/ld: cannot find -lglu
Similarly, I have freeglut installed.
If both of these functions are deprecated, I suppose it would be good practice for me to recode some. As far as I can tell, though, gluLookAt should be intact.
Offline
I'm having a similar problem (can't find gluPerspective or gluLookAt):
#ifdef __APPLE__ #include <GLUT/glut.h> #else #include <GL/glut.h> #endif
When I try to compile with -lglu, I get:
/usr/bin/ld: cannot find -lglu
Similarly, I have freeglut installed.
If both of these functions are deprecated, I suppose it would be good practice for me to recode some. As far as I can tell, though, gluLookAt should be intact.
Sorry to correct you, but this isn't a similar problem. The TO's problem was (as
I assume) that he didn't link against the glu library.
You, however, are linking against the glu library, but your linker can't find
it. If your compiler accepted your code with gluLookAt inside, it means that the
function is defined somewhere in the headers you included. If you didn't include
the glu.h header, I assume the function definition might have moved.
If you really only include glut.h, make sure you link against the glut library
and see if that fixes your problem.
Offline
I am linking with -lglut. Specifically, I call
gcc -Wall -g -pg -lglut -lm -o watershed vector.o tin.o primitives.o watershed.o rtimer.o ridge.o draw_tin.o
And I get the error
/home/chris/Coding/watershedtin/draw_tin.c:319: undefined reference to `gluPerspective'
/home/chris/Coding/watershedtin/draw_tin.c:322: undefined reference to `gluLookAt'
This is why I said I had a similar problem to the TO.
Offline
In that case, please try '-lGLU'. That library is supplied by mesa (which
freeglut depends on) and should be the one you seek.
Offline
Success! Thanks a bunch.
Offline
Success! Thanks a bunch.
You're welcome
Offline