I’m having problems getting SDL2_image to load jpgs and pngs (but it loads bmps fine).
Here is exactly what I am doing:
I am using MS Visual Studio 2008 and my OS is Windows XP, SP 2.
Step 1: Getting SDL
On 2/12/13, I used HG to get SDL via “hg clone http://hg.libsdl.org/SDL”.
I put this folder at C:\Libraries\SDL.
I opened C:\Libraries\SDL\VisualC\SDL_VS2008.sln. I set the active target to Release, and built the SDL2 project. It gives me an error “Cannot open include file: ‘dxsdkver.h’”. This error is removed by adding “C:\Program Files\Microsoft DirectX SDK (June 2010)\Include” to the project’s C/C++ General Additional Include Directories. And then SDL2 builds fine. SDL2Main is also built fine.
Step 2: Getting SDL_image
Then, also on 2/12/13, I used HG to get SDL_image via “hg clone http://hg.libsdl.org/SDL_image”. I saved this to C:\Libraries\SDL_image. I opened C:\Libraries\SDL_image\VisualC\SDL_image.sln. I set the active target to Release. In the SDL2_image project’s C/C++ General Additional Include Directories, I added “C:\Libraries\SDL\include”. Then, to the project’s Linker General section, I added to the Additional Library Directories “C:\Libraries\SDL\VisualC\SDL\Release” so it could find SDL2.lib. And then SDL2_image builds fine.
Step 3: Building showimage.exe
To the showimage project, like before I added references to “C:\Libraries\SDL\include” and “C:\Libraries\SDL\VisualC\SDL\Release”. I also added to the project’s C/C++ General Additional Include Directories a reference to “C:\Libraries\SDL\VisualC\SDLmain\Release” so it could find SDL2main.lib. And showimage.exe builds fine.
To run showimage.exe, adjacent to the exe I added SDL2.dll and SDL2_image.dll (which I built in step 1 and 2). As far as I’m aware, showimage.exe should be working fine now. I add 3 test images (a .bmp, a .jpg, and a .png). In the command prompt, I navigate to C:\Libraries\SDL_image\VisualC\showimage\Release\showimage.exe and I run it such as “showimage.exe TestBMP.bmp”, “showimage.exe TestJPG.jpg”, and “showimage.exe TestPNG.png”.
Loading a .bmp works fine, but any .jpg or .png fails to load. Though showimage.cpp uses IMG_LoadTexture, IMG_Load also fails to load .jpgs or .pngs. My guess is I missed a simple step to enable jpgs and pngs, but I can’t seem to figure out what it is.
Does anyone know what I’m doing wrong?
Thanks in advance.