I threw the lodePNG sample files into a blank project in Visual C++ 2008 Express, along with a 7kb PNG file I made, but I’m getting this memory allocation error during runtime:
Invalid allocation size: 429967295 bytes.
After breaking on the error & backtracking through stack frames, I think it’s being caused by a null argument being passed to the resize function in std::vector. This project was recently updated (April 2012), and is pretty thoroughly documented, so it’s possible that I’m doing something wrong (or don’t have the right compilation options). Would someone please take a look at my project?
Here’s a ZIP file of the project folder: http://www.mediafire.com/file/791b9z9ld74n3eu/TestLodePNG.zip
You most likely have the png file in the wrong place. By default, the working directory is where the project file is, not where the solution file is when running in the debugger. When I moved the file to the project file directory it worked fine.
You might consider adding some error checking to the the file opening code, like this: