Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-16-2004, 04:03 PM   #1
LQ Newbie
Registered: Aug 2004
Distribution: Slackware
Posts: 28

Rep: Reputation: 15
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:

#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?
Old 11-16-2004, 04:09 PM   #2
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
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...

Last edited by deiussum; 11-16-2004 at 04:12 PM.
Old 11-16-2004, 04:17 PM   #3
LQ Newbie
Registered: Aug 2004
Distribution: Slackware
Posts: 28

Original Poster
Rep: Reputation: 15
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using SDL/OpenGL, need help. kornerr Programming 33 11-19-2005 11:19 PM
sdl / opengl - cant press up and right atrain Linux - Games 2 03-27-2005 11:29 PM
question on NeHe OpenGL/SDL/linux tutorial Moebius Programming 0 12-08-2004 10:05 PM
Using OpenGL (+SDL) for 2D programs R00ts Programming 4 07-16-2004 12:33 PM
OpenGL lighting with SDL MadCactus Programming 0 09-21-2003 11:52 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:47 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration