View Full Version : Suse doesn't Compile for OpenGL!

03-05-2005, 11:26 PM
I would love to see anyone compile the simple openGL program below
without having problems under Suse. I've had no problems compiling under
Redhat and Mandrake. Can it be done with suse?

1) Someone try to compile this under there version of SUSE.
2) If successful, what had to be changed? Using gcc, what did you
type to compile it?

//begin------: opengltest.c

main(int argc, char *argv[])
glutInit(&argc, argv);
return 0; /* ANSI C requires main to return int. */
//end opengltest.c

I get:
gcc -lm -lGL opengltest.c
/tmp/ccAdiovA.o(.text+0x18): In function `main':
: undefined reference to `glutInit'
collect2: ld returned 1 exit status

On my system:
../ldconfig -p | grep glut
libglut.so.3 (libc6,x86-64) => /usr/lib64/libglut.so.3
libglut.so.3 (libc6) => /usr/lib/libglut.so.3

On my System:-------------------------------------------------
> 3Ddiag
3Ddiag version 0.722
Verifying 3D configuration:
Using 3dinfo
************************************************** **********

================================================== ==============
No 3D capable graphic chipset found!
================================================== ==============

Checking GL/GLU/glut runtime configuration:
GL/GLU ... done (package xorg-x11-Mesa)
glut ... done (package freeglut)

How do i compile the above program (opengltest.c)?


03-06-2005, 01:02 AM
Hi Jason, you should better ask your question in the forum OpenGL under Linux,

I have a SuSE too, but i didn't use it for dev, I remember that GCC isn't installed at starting, is it right ? So maybe there is some mistakes in packages installation, have you tried to compile a simple program without GL features ? I guess yes

Have you installed your graphic driver ? Is it working fine without crappy response ?

I see that you have included GL header, and normally you have included glut header too, you have specified the GL lib to the compiler, but have you specified glut library ? Something like -lglut...

That can explain why your compiler said "undefined reference to glutInit", because you use a glut function and you didn't give the lib to GCC, he don't know where glut is coming (:

I don't know if a simple glut program without reshape can work.. and I wonder why there is "no 3D chipset blahblah", because error certainly come from glut lib :confused:

anyway, hope that helps

03-06-2005, 07:45 AM
The compile command you used does not say the linker
to link with libglut.so. Try to add -lglut :
gcc opengltest.c -lGL -lglut -lm

it is simple, if say in future you are going to use functions from some oter library, say libCrap.so or
libabc.so you will have to tell that the linker with -lCrap or -labc , given that the libCrap.so or libabc.so are in locations known to Mr.linker if not
you will have to specify that info as well with -L/path/to/wherever/is/libcrap/installed .