LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Question about SDL OpenGL and -lglut (https://www.linuxquestions.org/questions/programming-9/question-about-sdl-opengl-and-lglut-255690/)

doody 11-16-2004 04:03 PM

Question about SDL OpenGL and -lglut
 
I've been using SDL for a couple of weeks now (almost finished with a pacman clone). I'm wanting to get into OpenGL a little bit (d/led and isntalled the Mesa3D library). I went to sdl's site and found a small example of using sdl to create an opengl surface to draw on.

These are the files that it includes:

Code:

#include <SDL/SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>

#include <stdio.h>
#include <stdlib.h>

This is what's confusing me:

g++ -o test test.cpp -L/usr/X11R6/lib -lglut `sdl-config --cflags --libs`

If I don't link glut I get errors. This doesn't make any sense to me because I thought SDL and glut were totally unrelated. Can someone shed some light on this for me?

deiussum 11-16-2004 04:09 PM

What are the exact linker errors? I notice that you aren't linking in -lGL or -lGLU... maybe when you link in -lglut, it is pulling those along for good measure and fixing your problem...

Also, if you are trying to use something like glutTeapot, glutSolidSphere, etc. you are still going to need to link in glut...

doody 11-16-2004 04:17 PM

Thanks for the response. The problem was indeed that I wasn't linking GL or GLU. This fixed the problem completely:

g++ -o test test.cpp -L/usr/X11R6/lib/ `sdl-config --cflags --libs` -lGLU


All times are GMT -5. The time now is 12:33 AM.