At first, here's my source code:
#include <SDL.h>
int main(int argc, char* argv[])
{
//initialize SDL and the video system.
if (SDL_Init( SDL_INIT_VIDEO)<0)
return -1;
//signal SDL to change the text of the main window to SDL "Hello World".
SDL_WM_SetCaption("Hello world","Hello World");
//Create an SDL_Surface object, which represents, the game window.
SDL_Surface* screen=SDL_SetVideoMode(640,480,0,0);
//Load the SDL logo bitmap to a temporary surface
SDL_Surface* temp=SDL_LoadBMP("data\\structures\\sdl_logo.bmp");
//Create the working SDL surface which matches the display format of the temporary surface.
SDL_Surface* bg= SDL_DisplayFormat(temp);
//Free the memory allocated to the temporary SDL_Surface.
SDL_FreeSurface(temp);
SDL_Event event;
bool quit=false;
//this is the main message loop if the game.
while(!quit)
{
//Check message qeue for an event.
if (SDL_PollEvent(&event))
{
//If an event was found.
switch (event.type)
{
//check to see if the window was closed via the "x"
case SDL_QUIT:
//Set the quit flag to true
quit=true;
break;
//Check the keyboard to see if the ESC key was pressed.
case SDL_KEYDOWN:
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE:
//set our quit flag to true
quit=true;
break;
}
break;
}
}
//Draw the background sprite:
SDL_BlitSurface(bg, NULL, screen, NULL);
//Update the current window.
SDL_UpdateRect(screen,0,0,0,0);
}
//Free the allocated memery for the background surface.
SDL_FreeSurface(bg);
//Quit SDL and allow it to clean up everything.
SDL_Quit();
//return control to windows with no errors.
return 0;
}
Well... my problem is, that i in some way must have mis-configured, my compiler. But since i'm new (Both at programming c++ and at using the compiler), i don't know how :S
the error meesages are, the following:
[Linker error] undefined reference to `SDL_Init'
[Linker error] undefined reference to `SDL_WM_SetCaption'
[Linker error] undefined reference to `SDL_SetVideoMode'
[Linker error] undefined reference to `SDL_RWFromFile'
[Linker error] undefined reference to `SDL_LoadBMP_RW'
[Linker error] undefined reference to `SDL_DisplayFormat'
[Linker error] undefined reference to `SDL_FreeSurface'
[Linker error] undefined reference to `SDL_PollEvent'
[Linker error] undefined reference to `SDL_UpperBlit'
[Linker error] undefined reference to `SDL_UpdateRect'
[Linker error] undefined reference to `SDL_FreeSurface'
[Linker error] undefined reference to `SDL_Quit'
[Linker error] undefined reference to `WinMain@16'
ld returned 1 exit status
As you can see, any command that i have used, which starts with SDL, has an undefinded referance. As i have come to understand, it has something to do with the way i have inclueded my files.
If some-one out there have used the dev-c++ compiler (Which i'm using), and also have experiaence with connecting that compiler to the SDL, it would be REALY nice if you would give me a, step, by step, tutorial, in how to do it. But it would also be nice if any1 else would bother to anwser, because that might be enouth to help me.
Please take in notice, that i'm VERY new to the langauge and compiler, so please don't use any words/sentences, that only experienced users understand