Prepare a program for converting the image format.
I posted a libpng on the Internet, including zlib.
Decompress the package and put it together. Check the projects in the projects directory.
When you use vs2008 to open vstudio \ vstudio. sln, the system prompts that the file version is too high. When you open visualc71 \ LibPNG. sln, the system prompts that the file version is too low and requires conversion.
If you are afraid of any conversion problems, use vs2010 to open the previous project.
Compile and generate one DLL and two Lib in debug mode.
Later, I used vs2008 to write the program and found that there was a problem with the compilation, but the execution program encountered an unhandled exception.
This is a very tangled problem. There may be a lot of reasons, and I have never been able to debug it, and I don't know du Niang.
Finally, I asked Gu Ge why vs2010 is used for compiling DLL and Lib. It may be different from the default value of 2008 in some configuration optimization settings.
I am also too lazy to compare the problem one by one. I used vs2010 to write the program directly, which is indeed no problem.
It works well to write the program in debug mode, but if you want to use static generation, you can change it to the release mode. No matter whether the result is static or not, the program runs properly. It seems that some people have encountered such a problem on the Internet, and reading the replies below does not solve the problem.
Png_read_png and png_write_png cannot pass through. when calling the _ lock_file () function in the fread function in debug, we can see that there is a write address conflict.
This allows me to find the underlying cause, but I am still struggling to recompile DLL and Lib in the release mode, and then compile my program, the results are the same...
(PS. I accidentally found that the DLL compiled in the release mode in debug mode also has problems ,-,-)
There is really no way, so we have to use 2008 to open the lower version of the project, convert it (fortunately there is no problem), and directly use the release mode to generate DLL and Lib.
Use 2008 to create your own program. The release mode and debug mode are all correct.
I don't know whether vs2010 optimization is doing well, whether it is more strict code requirements, or the libpng library problem. It is very tangled. If any good-hearted person knows why, please leave a message.
A simple program wastes a lot of time and you should pay attention to it later.
[Experience] 2010. This time, I am stuck.