LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 03-12-2003, 10:51 AM   #1
esko
LQ Newbie
 
Registered: Mar 2003
Posts: 2

Rep: Reputation: 0
problems with SDL


I'm using linux debian and i've installed SDL (1.2.something). When I try to compile the .c file like this:

gcc -o file -lSDL -lpthread file.c

I get errors: undefined reference to 'SDL_Init'
undefined reference to 'SDL_Quit'

file.c:

#include <stdio.h>
#include <SDL/SDL.h>

int main(int argc, char *argv[])
{
if (SDL_Init(SDL_INIT_VIDEO) < 0) { printf("error"); exit(1); }
atexit(SDL_Quit);
}

Why doesn't it work?
 
Old 03-12-2003, 12:55 PM   #2
tcaptain
LQ Addict
 
Registered: Jul 2002
Location: Montreal
Distribution: Gentoo 2004 from stage 1 baby!
Posts: 1,403

Rep: Reputation: 45
I think its not finding your SDL.h. SDL/SDL.h might not be in your standard include path?

For fun, change:

#include <SDL/SDL.h> with

#include "full path to SDL include files here/SDL.h"

and see if that changes anything...if it does then you have to somehow add your SDL includes to your include path
(I have no idea how to do this tho...I'm just starting to program in linux)
 
Old 03-12-2003, 01:32 PM   #3
verigoth
Member
 
Registered: May 2002
Posts: 179

Rep: Reputation: Disabled
actually, libSDL requires a few more compiler and linker directives than the ones you've stated. you should be compiling your files with the following line:

gcc -o file file.c `sdl-config --cflags --libs`

note: ` is not a ', it's a `

verigoth
 
  


Reply



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
SDL install problems dave`2005 Slackware 38 11-08-2005 04:17 PM
SDL problems? Huzza Programming 2 09-03-2005 10:58 AM
Trying to program an SDL application but cannot find the SDL.h file:SuSE 9.2&KDevelop pujolasdf Linux - Newbie 4 03-13-2005 07:50 AM
newbie problems with SDL nannerhead Linux - Games 2 02-13-2004 06:24 PM
SDL problems andrewh Linux - Newbie 3 11-16-2003 12:38 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:33 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration