compliling OpenGL on a HP-UX 10.X machine

I have been trying to complile a simple code to initialise and create a window. I know the code as no bugs since a copied it from a tutorial. I also checked that I was referencing to the correct library. When I use cc to compile my program it gives me a bunch of errors in gl.h. But when I use gcc, the compliler finds the GL library but doesn’t find glFlush, glClear or any other GL function. Here is what I use to compile and the result that I get.

gcc -o main main.c -I/opt/graphics/OpenGL/include -I/opt/graphics/OpenGL/contrib/libglut -I/usr/include/X11R6 -L/opt/graphics/OpenGL/lib -L/usr/lib/X11R6 -L/opt/graphics/OpenGL/contrib -L/opt/graphics/OpenGL/contrib/libglut -ldld -lGL -lGLU -lglut -lXhp11 -lXext -lXmu -lX11 -lm

The result is:
collect2: ld returned 1 exit status
/usr/ccs/bin/ld: Unsatisfied symbols:
glFlush (code)
glShadeModel (code)
glClear (code)
glClearColor (code)

It looks like the linker (ld) doesnt find the lib or doesnt like the format of the lib.

I am not an expert though. But i think you will have to interchange the order of the flags you used. Try using the following order:

-lglut -lGLU -lGL -lXhp11 -lXext -lXmu -lX11 -lm

instead of the order you used in ur makefile. Hope that helps!!

vijay.

Originally posted by muya:
[b]I have been trying to complile a simple code to initialise and create a window. I know the code as no bugs since a copied it from a tutorial. I also checked that I was referencing to the correct library. When I use cc to compile my program it gives me a bunch of errors in gl.h. But when I use gcc, the compliler finds the GL library but doesn’t find glFlush, glClear or any other GL function. Here is what I use to compile and the result that I get.

gcc -o main main.c -I/opt/graphics/OpenGL/include -I/opt/graphics/OpenGL/contrib/libglut -I/usr/include/X11R6 -L/opt/graphics/OpenGL/lib -L/usr/lib/X11R6 -L/opt/graphics/OpenGL/contrib -L/opt/graphics/OpenGL/contrib/libglut -ldld -lGL -lGLU -lglut -lXhp11 -lXext -lXmu -lX11 -lm

The result is:
collect2: ld returned 1 exit status
/usr/ccs/bin/ld: Unsatisfied symbols:
glFlush (code)
glShadeModel (code)
glClear (code)
glClearColor (code)[/b]