Compiling against libGL
I am interested in using SDL and OpenGL, and I have been trying to get it to work on my system.
I was using Mandrake Powerpack 8.0 now l’m on SuSE 7.3 professional (with NVIDIA 3D drivers installed) but I have the same problem.
When compiling a program (MesaDemos cube.c) i get a list of undefined reference to glCIear.glutlnit.. ete.
These are in the /usr/indude/GL/gl.h (and the header is being found) but they are in the form
GLAPI votd GLAPI ENTRY g*C!ear( GLbttfield mask
thing I have found to programming on a PC vvhich is vvhat I used to do on my old Amiga. Thanks again,
Raymond Mallar d
S lif you get undefined references, it
If k H §enerallymeans that y°u are not
f 1 compiling the program against the relavent library. Usually vvhen building an OpenGL/Mesa application, you vvould include -IGL and -IGLU in the gcc options, so you vvill first vvant to check that As you’ve been installing rpms and tarballs of Mesa, it may be that you have multiple versions of libGL, and the appropriate header fileş, installed vvhich can cause a vvhole load of problems. You should check /usr/local/lib for ‘libGL*; and delete anything vvhich exists, and also check /usr/local/include/GL Once you have deleted these, you’ll have to run /sbin/ldconfig as root, then try to build your programs again.
İt’s quite likely that vvhen you are trying to compile cube.c, the Makefile is not avvare of the location of libGL, so does not include the appropriate -IGL -IGLU options for gcc The MesaDemo’s use a ./configure script to build the Makefiles, and checking config.log and the output of Vconfigure vvill help you to diagnose the problems vvhich you are having vvith it not locating the OpenGL libraries.
XFIame, as I understand it, does not use the OpenGL system at ali, so it has no bearing on your problem at ali.
);
Could this GLAPI have some bearing on it? Another demo, XFIame, compiles and runs okay but doesn’t use those commands.
I have tried using the distro packages and downloading SDL-develop, MesaDemos and MesaLib rpms and tar fileş with the same result. Hope you can help, this is the elosest