c++mingwsdlsdl-image

How to fix 'The procedure entry point SDL_RWclose could not be located in the dynamic link library'


I'm trying to draw a png image to a window using the SDL_image extension, but it gives me an "Entry Point Not Found" error

I'm using SDL (2.0.9) and SDL_Image (2.0.5) I've copied the following bin files to the executable directory

main.cpp extract

#include <iostream>
#include <SDL.h>
#include <SDL_image.h>

int main( int argc, char* args[] )
{
    SDL_Texture* test_tex;
    SDL_Window* window = NULL;
    SDL_Renderer* renderer;

            if(renderer)
            {
                //Tested blank screen and it works
                /*
                SDL_RenderPresent(renderer);
                SDL_Delay(2000);
                */

                //Trying to use SDL_image and it fails
                SDL_Surface *tmp_surface = IMG_Load("player.png");
                test_tex = SDL_CreateTextureFromSurface(renderer,tmp_surface);
                SDL_FreeSurface(tmp_surface);
                SDL_RenderPresent(renderer);
                SDL_Delay(2000);
            }
...

Complied like this

g++ test.cpp ^
-IC:\dev\SDL2-2.0.9\i686-w64-mingw32\include\SDL2 ^
-IC:\dev\SDL2_image-2.0.5\i686-w64-mingw32\include\SDL2 ^
-LC:\dev\SDL2-2.0.9\i686-w64-mingw32\lib ^
-LC:\dev\SDL2_image-2.0.5\i686-w64-mingw32\lib ^
-lmingw32 ^
-lSDL2main ^
-lSDL2 ^
-lSDL2_image ^
-o test

I've tested the window with a blank renderer and it's all ok, It fails when I add the call to IMG_Load


Solution

  • The 2.0.9 32 bit SDL2.dll gave me issues with anything other than VC++. Fortunately the 2.0.10 version is available for testing which actually works for my Code::Blocks compiled tests: https://www.libsdl.org/tmp/download-2.0.php