[SDL] Using Directx with SDL

Pallav Nawani pallav at sasken.com
Tue Jan 21 20:37:00 PST 2003


begin Daniel Phillips <phillips at arcor.de> 
> On Wednesday 08 January 2003 21:14, Peter Jay Salzman wrote:
> > sdl newbie alert.  i'm getting the following warnings:
> >
> > warning: passing arg 2 of `SDL_MapRGB' with different width due to
> > prototype warning: passing arg 3 of `SDL_MapRGB' with different width due
> > to prototype warning: passing arg 4 of `SDL_MapRGB' with different width
> > due to prototype
> >
> > from this line of code:
> >
> >    Uint32 white = SDL_MapRGB(screen->format, 255, 255, 255);
> 
> There is nothing wrong with that line of code.  It does not cause a warning
> here (gcc 2.95.4).  Which compiler?
 
hi daniel,

aiieee.  mea culpa!  sometimes i forget the fact that the entire world
doesn't use GNU/linux.  sorry about that.

i'm on a linux box, and the error happens with both gcc-2.95 and
gcc-3.0.


here is the makefile:

   WARN = -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations\
    -Wtraditional -Wshadow -Wpointer-arith -Wcast-qual -Winline -Wredundant-decls\
    -Wconversion -Waggregate-return -Wnested-externs -Wcast-align -Wwrite-strings
   CFLAGS = -g ${WARN}
   LIBS = `sdl-config --libs`
   
   all:
      gcc-3.0 ${WARN} blah.c ${LIBS}

and proof of concept code, "blah.c":

   #include <SDL/SDL.h>
   #include <stdlib.h>
   SDL_Surface *init_Video(void);
   int main(void);
   
   int main(void)
   {
      SDL_Surface *screen = init_Video();
      Uint32 white = SDL_MapRGB(screen->format, 255, 255, 255);
      return 0;
   }
   
   SDL_Surface *init_Video(void)
   {
      Uint32 flags = SDL_SWSURFACE;
      Uint32 bpp = 32;
      SDL_Surface *screen;
   
      SDL_Init(SDL_INIT_VIDEO);
      atexit(SDL_Quit);
      bpp = SDL_VideoModeOK(640, 480, bpp, flags);
      screen = SDL_SetVideoMode(640, 480, bpp, flags);
      return screen;
   }


and the error messages that both gcc-3.0 and gcc-2.95 give:

  p at satan% make
  gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes
  -Wmissing-declarations -Wtraditional -Wshadow -Wpointer-arith
  -Wcast-qual -Winline -Wredundant-decls -Wconversion -Waggregate-return
  -Wnested-externs -Wcast-align -Wwrite-strings blah.c `sdl-config --libs`
  
  blah.c: In function `main':
  blah.c:10: warning: passing arg 2 of `SDL_MapRGB' with different width due to prototype
  blah.c:10: warning: passing arg 3 of `SDL_MapRGB' with different width due to prototype
  blah.c:10: warning: passing arg 4 of `SDL_MapRGB' with different width due to prototype
  blah.c:10: warning: unused variable `white'
  blah.c: In function `init_Video':
  blah.c:23: warning: passing arg 3 of `SDL_VideoModeOK' as signed due to prototype
  blah.c:24: warning: passing arg 3 of `SDL_SetVideoMode' as signed due to prototype


do you get the same thing?  i'm using sdl 1.2 (debian sarge, current).

pete




More information about the SDL mailing list