Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

  • libjpeg-9.dll
  • libpng16-16.dll
  • libtiff-5.dll
  • libwebp-7.dll
  • SDL2.dll
  • SDL2_image.dll
  • zlib1.dll

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

like image 638
linjoehan Avatar asked Dec 17 '22 16:12

linjoehan


2 Answers

You need another SDL_Image version. Use SDL_Image (2.0.4) instead of (2.0.5).

You can get the older versions here:

https://www.libsdl.org/projects/SDL_image/release/?C=M;O=D

(That fixed the same problem for me)

like image 103
ThePyramidOfDoom Avatar answered Dec 20 '22 05:12

ThePyramidOfDoom


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

like image 45
DrBorisG Avatar answered Dec 20 '22 07:12

DrBorisG