LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 11-16-2004, 04:03 PM   #1
doody
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:

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

Rep: Reputation: 31
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
doody
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
 
  


Reply


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


All times are GMT -5. The time now is 07:11 AM.

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