Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Failing at SDL

Name: Anonymous 2011-05-27 20:14

>Decide to go do the SDL tutorial on LazyFoo's site
>Type out first tutorial, code looks like so:

#include <SDL/SDL.h>

int main() {

        SDL_Surface* hello = NULL;
        SDL_Surface* screen = NULL;

        SDL_Init( SDL_INIT_EVERYTHING );
        screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );
        hello = SDL_LoadBMP( "hello.bmp" );

        SDL_BlitSurface( hello, NULL, screen, NULL );
        SDL_Flip( screen );
        SDL_Delay( 2000 );

        return 0;
}


Compile like so

g++ -framework SDL -o SDLtest test.cc

Get the following linker error:

Undefined symbols:
  "_main", referenced from:
      start in crt1.10.6.o
     (maybe you meant: SDL_main())
ld: symbol(s) not found
collect2: ld returned 1 exit status

ld doesn't know what the fuck main is?

Name: Anonymous 2011-05-27 20:46

g++ -lSDL -o SDLtest test.c
works for me

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List