This program makes an error that says something about the memory location. The error itself does not say anything specific about the problem. I am trying to remove the background in an image...
Were will cout write "Problem loading image"? I don't think it is possible to output right out to the window that shows the image. But I can confirm that the image loads correctly because when I remove the two lines with colorkey everything works like expected.
I thought you were getting a memory violation error during runtime (which is similar to what would show up if it could not find the image correctly). I would also suggest posting exactly what the error message says.
I just suggested cout as you can have the console running along side the window if you wanted to.
Your code seems to be set up correctly for me, I have heard of SDL_SetColorKey having problems with 32-bit images so you might want to make sure yours is 24-bit and try it.
What do you mean by 24bit and 32bit? Shouldn't the image work whatever format? and how do I change it? I can show it with the normal background but I want to remove it.
Wow, so much work still haven't found a solution. I wish there would just be an installer for installing sdl. The problem is probably with my way of installing it. Showing a picture works though.
Ok some new info, that might help solve the problem. If I remove the line the program will work, but not show the picture unless you run the program from the folder. (instead of when compiling) The problem may be that the compiler don't look for the picture there, and it may not even look for it before it is done compiling. Anyone familiar with visual studio 2012?
It will look for the file in the current working directory. If the current working directory is not the same directory where Test.png is located it will not find it. If you start your program by double clicking on the executable file the current working directory will be the directory where the executable file is located. If you start your program from the command line the current working directory will be the directory that you set using the cd command. If you start your program from an IDE the current working directory is often set to the project directory (not the source directory) but this can differ between IDEs.