Marcusflint 0 Newbie Poster

Hi,
Im new to SDL, when i compile this example program i got these linker errors

 first defined here   
 .drectve `/manifestdependency:"type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
 [Linker error] undefined reference to `__security_cookie' 
 [Linker error] undefined reference to `_alloca_probe_16' 
 [Linker error] undefined reference to `@__security_check_cookie@4' 
 [Linker error] undefined reference to `_imp____iob_func' 
 [Linker error] undefined reference to `_imp____iob_func' 
 [Linker error] undefined reference to `_imp____iob_func'
 [Linker error] undefined reference to `__security_cookie' 
 [Linker error] undefined reference to `_alloca_probe_16' 
 [Linker error] undefined reference to `@__security_check_cookie@4'
 [Linker error] undefined reference to `__security_cookie'
 [Linker error] undefined reference to `_imp____iob_func' 
 [Linker error] undefined reference to `_imp____iob_func' 
 [Linker error] undefined reference to `_imp____iob_func'
 [Linker error] undefined reference to `_imp____iob_func'
 [Linker error] undefined reference to `_imp____iob_func'
 more undefined references to `_imp____iob_func' follow 
 [Linker error] undefined reference to `@__security_check_cookie@4' 
 ld returned 1 exit status
 C:\Dev-Cpp\Makefile.win [Build Error]  [sdlreal.exe] Error 1 

example:

#include "SDL.h" 
#include <stdio.h>

void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel); 

int main(int argc, char *argv[]) 
{ 
 SDL_Surface *screen; 
 int quit = 0; 
 SDL_Event event; 
 int x, y; 
 Uint32 yellow; 


 if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) 
 { 
  printf("Could not initialize SDL: %s.\n", SDL_GetError()); 
  return -1; 
 } 

 screen = SDL_SetVideoMode(800, 600, 24, SDL_SWSURFACE | SDL_FULLSCREEN);
 if ( screen == NULL ) 
 { 
  fprintf(stderr, "Couldn't set 800x600x24 video mode: %s\n", SDL_GetError()); 
  return -2; 
 } 


 yellow = SDL_MapRGB(screen->format, 0xff, 0xff, 0x00); 


 x = screen->w / 2; 
 y = screen->h / 2; 

 while( !quit ) 
 { 

  while( SDL_PollEvent( &event ) ) 
  { 
   switch( event.type ) 
   { 
    case SDL_KEYUP: 
     if(event.key.keysym.sym == SDLK_ESCAPE) 
      quit = 1; 
      break; 
     if(event.key.keysym.sym == SDLK_F1) 
      SDL_WM_ToggleFullScreen(screen); // Only on X11 
      break; 
    case SDL_QUIT: 
     quit = 1; 
     break; 
    default: 
     break; 
   } 
  } 


  if ( SDL_MUSTLOCK(screen) ) 
  { 
   if ( SDL_LockSurface(screen) < 0 ) 
   { 
    fprintf(stderr, "Can't lock screen: %s\n", SDL_GetError()); 
    return -3; 
   } 
  } 


  putpixel(screen, x, y, yellow); 


  if ( SDL_MUSTLOCK(screen) ) 
  { 
   SDL_UnlockSurface(screen); 
  } 


  SDL_UpdateRect(screen, x, y, 1, 1); 
 } 

 SDL_Quit(); 

 return 0; 
} 

void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel) 
{ 
 int bpp = surface->format->BytesPerPixel; 
 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; 
 switch(bpp) 
 { 
  case 1: 
   *p = pixel; 
   break; 
  case 2: 
   *(Uint16 *)p = pixel; 
   break; 
  case 3: 
   if(SDL_BYTEORDER == SDL_BIG_ENDIAN) 
   { 
    p[0] = (pixel >> 16) & 0xff; 
    p[1] = (pixel >> 8) & 0xff; 
    p[2] = pixel & 0xff; 
   } else { 
    p[0] = pixel & 0xff; 
    p[1] = (pixel >> 8) & 0xff; 
    p[2] = (pixel >> 16) & 0xff; 
   } 
   break; 
  case 4: 
   *(Uint32 *)p = pixel; 
   break; 
 } 
} 

please help me get rid of them...

thanks very much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.