LinuxQuestions.org
Visit Jeremy's Blog.
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-08-2003, 03:06 PM   #1
bignester
Member
 
Registered: Jun 2003
Location: Texas
Distribution: Slackware
Posts: 30

Rep: Reputation: 15
Cant init SDL library


this is the error

/tmp/ccchrNRk.o(.text+0x16): In function `main':
: undefined reference to `SDL_Init'
collect2: ld returned 1 exit status

what does this mean

here is the code that im using

#include <SDL/SDL.h>
#include <iostream>
#include <vector>

using namespace std;

int main() {
if(!SDL_Init(SDL_INIT_VIDEO)) {
cout<<"error"<<endl;
}
return 0;
}

am i missing something or could i not have the library installed right.

Last edited by bignester; 07-08-2003 at 03:09 PM.
 
Old 07-08-2003, 03:18 PM   #2
TheLinuxDuck
Member
 
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
Sounds to me that the library wasn't linked in the binary during compilation. What CL did you use to compile it?
 
Old 07-08-2003, 03:27 PM   #3
bignester
Member
 
Registered: Jun 2003
Location: Texas
Distribution: Slackware
Posts: 30

Original Poster
Rep: Reputation: 15
Well i just did this

g++ test.cpp

how do i link at compile time
 
Old 07-08-2003, 03:32 PM   #4
TheLinuxDuck
Member
 
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
You'll have to also include the library when compiling the code. I *think* it's
Code:
g++ test.cpp -lSDL
but I'm not 100% on the name of the library.. that should be right. If your SDL library isn't in a standard place (/lib. /usr/lib, /usr/local/lib) you'll also have to put -L/path/name/to/libraries before the -lSDL.

Also, if it doesn't find 'SDL', try 'sdl' also.
 
  


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
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
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 04:20 AM
what is the function library of the basic graphics library in rethat9.0? zerwolve Red Hat 0 04-29-2004 09:18 PM
Kernal Panic: No init found. Try passing init= option to kernel raees Linux - General 12 03-18-2004 11:10 PM
error "Kernel panic: No init found. Try passing init= option Anauj0101 Linux - Newbie 3 05-06-2003 10:18 PM

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

All times are GMT -5. The time now is 04:08 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