1

I'm following the LazyFoo's SDL Tutorial with C (not CPP) and I'm stuck at the part where I switch from SDL_LoadBMP() to IMG_Load(). The function

SDL_Surface *load_image(char *filename) {

    SDL_Surface* loadedImage = NULL;
    SDL_Surface* optimizedImage = NULL;

    loadedImage = SDL_LoadBMP(filename);

    if(loadedImage != NULL) {
        optimizedImage = SDL_DisplayFormat( loadedImage );

        SDL_FreeSurface(loadedImage);
    }

    return optimizedImage;
}

Works just fine with

background = load_image("background.bmp");

but if I change

loadedImage = SDL_ImageBMP(filename);

it to

loadedImage = IMG_Load(filename);

and build/run it triggers the 0xc000007b error. I'm pretty sure I installed the SDL_image.h library properly cause I followed the steps carefuly. So my question is: what's wrong? From google I've come only to: something with .dll's but - what? I'm using Visual Studio 2010, but it happens with Code::Blocks as well (but there it just won't compile)

genpfault
  • 51,148
  • 11
  • 85
  • 139
Deith
  • 133
  • 2
  • 9

1 Answers1

-1

take the SDL.dll

from the sdl you downloaded

(from http://www.libsdl.org/release/SDL-devel-1.2.15-VC.zip) and paste it alongside of the executable.

Try the one in the lib/x86 folder

then remove any SDL.dll file you may have pasted in System32/ or System/ or SysWOW64/ during your sdl installing process

4do5
  • 1