Iubdou
September 6th, 2010, 04:12 PM
I'm using a development environment called Geany that handles multiple languages and since I'm taking a variety of programming courses it seemed appropriate to go for this one, but I can't for the life of me get SDL to play nice with it. I've tried various fixes ranging from reinstalling packages to trying to link it by hand but nothing is working so here's the original error output and the code that generated it. Maybe someone can shed some light on this for me.
//Include SDL functions and datatypes
#include "SDL/SDL.h"
int main( int argc, char* args[] ) {
//The images
SDL_Surface* hello = NULL;
SDL_Surface* screen = NULL;
//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );
//Set up screen
screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );
//Load image
hello = SDL_LoadBMP( "hello.bmp" );
//Apply image to screen
SDL_BlitSurface( hello, NULL, screen, NULL );
//Update Screen
SDL_Flip( screen );
//Pause
SDL_Delay( 2000 );
//Free the loaded image
SDL_FreeSurface( hello );
//Quit SDL
SDL_Quit();
return 0;
}
gcc -Wall -o "BasicSDL" "BasicSDL.c" (in directory: *omitted: irrelevant to error*)
/tmp/ccV8txp6.o: In function `main':
BasicSDL.c:(.text+0x25): undefined reference to `SDL_Init'
BasicSDL.c:(.text+0x3e): undefined reference to `SDL_SetVideoMode'
BasicSDL.c:(.text+0x51): undefined reference to `SDL_RWFromFile'
BasicSDL.c:(.text+0x5e): undefined reference to `SDL_LoadBMP_RW'
BasicSDL.c:(.text+0x7c): undefined reference to `SDL_UpperBlit'
BasicSDL.c:(.text+0x88): undefined reference to `SDL_Flip'
BasicSDL.c:(.text+0x92): undefined reference to `SDL_Delay'
BasicSDL.c:(.text+0x9e): undefined reference to `SDL_FreeSurface'
BasicSDL.c:(.text+0xa3): undefined reference to `SDL_Quit'
collect2: ld returned 1 exit status
Compilation failed.
//Include SDL functions and datatypes
#include "SDL/SDL.h"
int main( int argc, char* args[] ) {
//The images
SDL_Surface* hello = NULL;
SDL_Surface* screen = NULL;
//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );
//Set up screen
screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );
//Load image
hello = SDL_LoadBMP( "hello.bmp" );
//Apply image to screen
SDL_BlitSurface( hello, NULL, screen, NULL );
//Update Screen
SDL_Flip( screen );
//Pause
SDL_Delay( 2000 );
//Free the loaded image
SDL_FreeSurface( hello );
//Quit SDL
SDL_Quit();
return 0;
}
gcc -Wall -o "BasicSDL" "BasicSDL.c" (in directory: *omitted: irrelevant to error*)
/tmp/ccV8txp6.o: In function `main':
BasicSDL.c:(.text+0x25): undefined reference to `SDL_Init'
BasicSDL.c:(.text+0x3e): undefined reference to `SDL_SetVideoMode'
BasicSDL.c:(.text+0x51): undefined reference to `SDL_RWFromFile'
BasicSDL.c:(.text+0x5e): undefined reference to `SDL_LoadBMP_RW'
BasicSDL.c:(.text+0x7c): undefined reference to `SDL_UpperBlit'
BasicSDL.c:(.text+0x88): undefined reference to `SDL_Flip'
BasicSDL.c:(.text+0x92): undefined reference to `SDL_Delay'
BasicSDL.c:(.text+0x9e): undefined reference to `SDL_FreeSurface'
BasicSDL.c:(.text+0xa3): undefined reference to `SDL_Quit'
collect2: ld returned 1 exit status
Compilation failed.