如何修复 'The procedure entry point SDL_RWclose could not be located in the dynamic link library'

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

我正在尝试使用 SDL_image 扩展将 png 图像绘制到 window,但它给我一个 "Entry Point Not Found" 错误

我正在使用 SDL (2.0.9) 和 SDL_Image (2.0.5) 我已经将以下bin文件复制到可执行目录

main.cpp 摘录

#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);
            }
...

就这样答应了

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

我用空白渲染器测试了 window,一切正常,当我添加对 IMG_Load

的调用时失败

2.0.9 32 位 SDL2.dll 给了我除 VC++ 以外的任何问题。幸运的是,2.0.10 版本可用于测试,它实际上适用于我的 Code::Blocks 编译测试:https://www.libsdl.org/tmp/download-2.0.php

您需要另一个 SDL_Image 版本。使用 SDL_Image (2.0.4) 而不是 (2.0.5).

您可以在此处获取旧版本:

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

(为我解决了同样的问题)