Hi,
I am having horrible problems compiling SDL programs in MinGW
3.1.0-1, MSYS-1.0.11, gcc-core-3.4.1, and SDL 1.2.7. Here is how I am
compiling it with the code below. (also, I have left the header as
pointed out in the book Linux Game Programming <SDL/SDL.h> to <SDL.h>
or “SDL.h”).
$ gcc -o blitting_surfaces_sdl.exe blitting_surfaces_sdl.c
-I"C:/mingw/include/SDL-1.2.7"
blitting_surfaces_sdl.c: In function `SDL_main’:
blitting_surfaces_sdl.c:6: error: number of arguments doesn’t match prototype
/mingw/include/SDL_main.h:54: error: prototype declaration
#include <SDL.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
SDL_Surface *screen;
SDL_Surface *image;
SDL_Rect src, dest;
// Init SDL’s video system and check for errors
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
printf(“Unable to initialize SDL: %s\n”, SDL_GetError());
return 1;
}
// Make sure SDL_Quit gets called when the program exits! d
atexit(SDL_Quit);
screen = SDL_SetVideoMode(256, 256, 16, 0);
if(screen == NULL)
{
printf(“Unable to set video mode: %s\n”, SDL_GetError());
return 1;
}
image = SDL_LoadBMP(“test-image.bmp”);
if(image == NULL)
{
printf(“Unable to load bitmap.\n”);
return 1;
}
src.x = 0;
src.y = 0;
src.w = image->w;
src.h = image->h;
dest.x = 0;
dest.y = 0;
dest.w = image->w;
dest.h = image->h;
SDL_BlitSurface(image, &src, screen, &dest);
SDL_UpdateRect(screen, 0, 0, 0, 0);
SDL_Delay(10000);
SDL_FreeSurface(image);
return 0;
}
Thanks!
Dexter F. Stowers