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 07-15-2005, 04:09 AM   #1
kira
Member
 
Registered: Dec 2004
Distribution: redhat linux
Posts: 88

Rep: Reputation: 15
compiled error


error occured while compiling, i got the wrong messages like below:

/tmp/cc4/HK9Z5.o (text+0x16): in function 'main'
:undefined reference to 'SDL_Init'

the command for compilation is : gcc -o sdl sdl.c -W -I /usr/include/SDL
the score code is:

#include <stdlib.h>
#include "SDL.h"

main(int argc, char *argv[])
{
if ( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "can't initilize SDL: %s\n", SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
}

thanks in advance.
 
Old 07-15-2005, 06:22 AM   #2
sind
Member
 
Registered: Jun 2005
Posts: 75

Rep: Reputation: 15
I haven't used SDL before, but I think using this might make it work:

Code:
$ gcc -o sdl sdl.c -W -I /usr/include/SDL -lSDL
Have a look at the output of:

Code:
$ sdl-config --libs
if it still doesn't work and if that command is available.

~sind
 
Old 07-15-2005, 10:33 AM   #3
rockytriton
LQ Newbie
 
Registered: Jul 2005
Posts: 9

Rep: Reputation: 0
You need to link to the SDL library, check the docs for SDL, they should have sample make files.
 
  


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
asterisk compiled error johnrage SUSE / openSUSE 1 12-01-2005 07:11 AM
PPWD when using compiled bash error davegermiquet Linux From Scratch 0 12-24-2004 06:48 PM
error: cannot run C compiled programs. terry.trent Linux - Newbie 6 08-05-2004 11:07 PM
I compiled and intstalled a screensaver, but I can't configure it. I get an error... Ausar Linux - Newbie 3 08-05-2004 08:47 PM
sound error, after compiled kernel kryptobs2000 Linux - General 15 12-19-2003 11:00 AM

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

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

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