SDL_image初始化失败求助:找不到libpng16-16.dll模块
SDL2 Image Loading Failure: Can't Load BMP File Even After Successful Initialization
I've spent an hour trying to fix this error, searching Stack Overflow and other websites for solutions with no luck. I'm really stuck and need urgent help to get back to learning SDL2.
Software & Library Versions I'm Using:
- SDL2-2.0.12
- SDL2_image-2.0.5
- Visual Studio Community 2019
Problematic Code Section:
bool CApp::OnInit() { if (SDL_Init(SDL_INIT_VIDEO) < 0) { printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError()); return false; } else { std::cout << "SDL was initialized!!!" << std::endl; } // The window for the game. Surf_Window = SDL_CreateWindow("SDL2 Window", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screenWidth, screenHeight, 0); if (Surf_Window == NULL) { return false; } else { std::cout << "Main Window was initialized!!!" << std::endl; //Initialize PNG loading int imgFlags = IMG_INIT_PNG; if (!(IMG_Init(imgFlags) & imgFlags)) { printf("SDL_image could not initialize! SDL_image Error: %s\n", IMG_GetError()); return false; } else { std::cout << "SDL_image was initialized!!!" << std::endl; //Get window surface Surf_Display = SDL_GetWindowSurface(Surf_Window); if (Surf_Display == NULL) { return false; } } } // Fill the window with White color. SDL_FillRect(Surf_Display, NULL, SDL_MapRGB(Surf_Display->format, 0xFF, 0xFF, 0xFF)); // The image surface we load. const char* image = "data/images/bgHomeScreen.bmp"; Surf_Test = CApp::OnLoad("data/images/bgHomeScreen.bmp"); //CSurface::OnLoad(Surf_Test, image); if (Surf_Test == NULL) { printf("Unable to load image %s! SDL Error: %s\n", "data/images/bgHomeScreen.bmp", SDL_GetError()); return false; } SDL_UpdateWindowSurface(Surf_Window); SDL_Delay(2000); return true; }
Additional Context:
I've included screenshots of my project settings for reference.
I need to resolve this image loading error so I can continue learning SDL2.
内容的提问来源于stack exchange,提问作者Aeryes
相关产品推荐
相关产品推荐

