LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Cant init SDL library (https://www.linuxquestions.org/questions/programming-9/cant-init-sdl-library-71053/)

bignester 07-08-2003 03:06 PM

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.

TheLinuxDuck 07-08-2003 03:18 PM

Sounds to me that the library wasn't linked in the binary during compilation. What CL did you use to compile it?

bignester 07-08-2003 03:27 PM

Well i just did this

g++ test.cpp

how do i link at compile time

TheLinuxDuck 07-08-2003 03:32 PM

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.


All times are GMT -5. The time now is 01:29 PM.