help installing glut
Hi! I'm really desperate in getting a complete answer on this one. I'm trying to make a gui for my c application. It has to use mesa. After visiting a few websites, I realize that I need to use glut, which provides windowing functionality for mesa. Now, I have already installed all packages which I think are necessary.
These packages are found in the mandrake 9.1 distribution cds: libMesaGL1-5.0-3mdk libMesaGLU1-5.0-3mdk libMesaGLU1-devel-5.0-3mdk libMesaglut3-5.0-3mdk libMesaglut3-devel-5.0-3mdk Mesa-5.0-3mdk Mesa-demos-5.0-3mdk Here is a sample c application that uses glut: Code: Code:
#include <GL/glut.h> undefined reference to glutInit undefined reference to glutInitDisplayMode undefined reference to glutInitWindowPosition undefined reference to glutInitWindowSize undefined reference to glutCreateWindow undefined reference to glutCreateMainLoop compiling it with "gcc simpleGlut.c" outputs: cannot find lglut I viewed the GL/glut.h file in the /usr/include directory. I saw that the function prototypes were there. I think there's something wrong with the library i'm compiling with. is it really "gcc simpleGlut.c -lglut"? Or something else? Do I need the opengl-devel package installed? I can't find it in the linux distribution cds. Maybe you could give me a link to a good website on this topic? I got nothing from www.mesa3d.org. I'm using mandrake 9.1. Thanks for reading this long post. |
gcc -I/usr/X11R6/include -lglut -o simpleGlut simpleGlut.c
-I (eye) says look for includes in this dir -l (ell) says use this library -o output binary name |
hi! thanks for the quick reply. I tried compiling it with:
gcc -I/usr/X11R6/include -lglut -o simpleGlut simpleGlut.c I still got undefined referece to (functionName) errors. I found out that there was a /user/X11R6/include/GL directory. So i tried: gcc -I/usr/X11R6/include/GL -lglut -o simpleGlut simpleGlut.c I still got the same errors. How do I know if I have the libglut.a library? how do I know its the right one? I initially didn't have one even though I already installed the above mentioned packages. So, I downloaded one and placed it into the /usr/lib directory. My _simple_ code still doesn't compile. Any ideas? |
I'll start out with a simple fix: Did you run /sbin/ldconfig after installing the libraries?
Then, a suggestion: You may want to check out freeglut. Enjoy! --- Cerbere |
I ran the /sbin/ldconfig. Then, I tried compiling the code again. I still got the same undefined reference errors. I also installed freeglut. Here are the steps I took:
1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Type `make install' to install the programs and any data files and documentation. I also added /usr/local/lib (where libglut.a libglut.la libglut.so libglut.so.3 libglut.so.3.8.0 were) to the LD_LIBRARY_PATH and LD_RUN_PATH. I compiled the program again with 'gcc simpleGlut.c -lglut'. I still got those errors. What's wrong? |
try adding /usr/local/lib to /etc/ld.so.conf
run ldconfig gcc -I/usr/X11R6/include -L/usr/local/lib -lglut -o simpleGlut simpleGlut.c -L says look for libraries in dir, and should be put before the lib you're using the undefined reference error usually means it just can't find the library. you don't want to add the GL dir for the include in your compile line, because it's already specified in your source file as GL/glut.h (it would be looking for /usr/X11R6/include/GL/GL/glut.h) |
Quote:
simpleGlut: relocation error: /usr/X11R6/lib/libglut.so.3: undefined symbol: glXQueryExtension something new for a change. Thanks for sticking with me guys! I'll look on more into this. Maybe you have encountered this error before? =) |
I got it working!
i compiled with: gcc -I/usr/X11R6/include -L/usr/local/lib -lglut -lGL -lGLU -o simpleGlut simpleGlut.c how do I compile without using -I and -L? Do I add it to some environment variable? I have just realized that I can't make widgets with glut alone. I need glow. This time, I'm getting undefined reference errors in my glow program. I think its because of the makefile. I think it doesn't use the -I and -L tags when compiling. I'll keep you updated. |
hi!
I've just gone through the examples found in the glui package. Does anyone know how to set the glui window as the main graphics window? I don't want the window created with glutCreateWindow. I just need the GLUI *glui = ... create_glui( "title' );. Also, does anyone know how to load images in glui? I've been through the manual and it doesn't say anything about this. Thanks! |
All times are GMT -5. The time now is 04:26 AM. |