{"id":2412,"date":"2016-12-03T21:57:29","date_gmt":"2016-12-04T05:57:29","guid":{"rendered":"http:\/\/pididu.com\/wordpress\/?p=2412"},"modified":"2016-12-04T08:06:44","modified_gmt":"2016-12-04T16:06:44","slug":"compile-libpng-as-a-static-library-for-windows-with-visual-studio-2010-express","status":"publish","type":"post","link":"http:\/\/pididu.com\/wordpress\/blog\/compile-libpng-as-a-static-library-for-windows-with-visual-studio-2010-express\/","title":{"rendered":"Compile libpng as a Static Library for Windows with Visual Studio 2010 Express"},"content":{"rendered":"<p>I thought I had a simple request. I wanted to save the contents of a Window in my WINAPI application to a png file. At first, I looked at Gnuwin32 for a precompiled version of libpng for Windows, but found that the version offered was dated, and required use of DLL&#8217;s. So it was necessary to recompile the source myself. Here are the steps I followed.<\/p>\n<figure id=\"attachment_2413\" aria-describedby=\"caption-attachment-2413\" style=\"width: 759px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/1-visual-studio-directory.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2413\" alt=\"visual studio projects directory\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/1-visual-studio-directory.png\" width=\"759\" height=\"417\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/1-visual-studio-directory.png 759w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/1-visual-studio-directory-100x54.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/1-visual-studio-directory-300x164.png 300w\" sizes=\"(max-width: 759px) 100vw, 759px\" \/><\/a><figcaption id=\"caption-attachment-2413\" class=\"wp-caption-text\">Make sure Visual C (Visual Studio) is loaded. Mine is the free Visual C\/C++ 2010 Express. Locate the Projects directory for Visual Studio.<\/figcaption><\/figure>\n<figure id=\"attachment_2414\" aria-describedby=\"caption-attachment-2414\" style=\"width: 676px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/2-downloads.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2414\" alt=\"zip files for zlib and libpng\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/2-downloads.png\" width=\"676\" height=\"343\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/2-downloads.png 676w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/2-downloads-100x50.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/2-downloads-300x152.png 300w\" sizes=\"(max-width: 676px) 100vw, 676px\" \/><\/a><figcaption id=\"caption-attachment-2414\" class=\"wp-caption-text\">Download the source files for zlib and libpng. You can find them by Googling &#8220;zlib source&#8221; and &#8220;libpng source&#8221;. Look carefully at the choices &#8211; you want the sources, NOT the compiled versions, and the ZIP format is probably the easiest for Windows to deal with. Unpack the ZIP files.<\/figcaption><\/figure>\n<figure id=\"attachment_2415\" aria-describedby=\"caption-attachment-2415\" style=\"width: 676px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/3-check-inside.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2415\" alt=\"check directory structure\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/3-check-inside.png\" width=\"676\" height=\"343\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/3-check-inside.png 676w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/3-check-inside-100x50.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/3-check-inside-300x152.png 300w\" sizes=\"(max-width: 676px) 100vw, 676px\" \/><\/a><figcaption id=\"caption-attachment-2415\" class=\"wp-caption-text\">Click down into the directories you just expanded to make sure there are source files there. Depending on how you did the expansion, the source may actually be in another folder with the same name inside the first folder. For the next step, you want to move whichever folder contains the source itself.<\/figcaption><\/figure>\n<figure id=\"attachment_2416\" aria-describedby=\"caption-attachment-2416\" style=\"width: 801px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/5-move-libpng-and-zlib-dirs.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2416\" alt=\"move libpng and zlib to projects\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/5-move-libpng-and-zlib-dirs.png\" width=\"801\" height=\"744\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/5-move-libpng-and-zlib-dirs.png 801w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/5-move-libpng-and-zlib-dirs-100x92.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/5-move-libpng-and-zlib-dirs-300x278.png 300w\" sizes=\"(max-width: 801px) 100vw, 801px\" \/><\/a><figcaption id=\"caption-attachment-2416\" class=\"wp-caption-text\">Move or copy the folders with libpng and zlib to the Projects folder for Visual Studio.<\/figcaption><\/figure>\n<figure id=\"attachment_2417\" aria-describedby=\"caption-attachment-2417\" style=\"width: 759px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/6-locate-solution-file.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2417\" alt=\"solution file for libpng\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/6-locate-solution-file.png\" width=\"759\" height=\"433\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/6-locate-solution-file.png 759w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/6-locate-solution-file-100x57.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/6-locate-solution-file-300x171.png 300w\" sizes=\"(max-width: 759px) 100vw, 759px\" \/><\/a><figcaption id=\"caption-attachment-2417\" class=\"wp-caption-text\">Locate the solution file down in the directory hierarchy. It is at D:\\My Documents\\Visual Studio 2010\\Projects\\lpng1626\\projects\\vstudio in this case. <em><strong> DO NOT DOUBLE CLICK<\/strong> on this file name.<\/em> Visual studio will be suspicious of a foreign file, and will probably silently refuse to open it. Just note the location for now.<\/figcaption><\/figure>\n<figure id=\"attachment_2418\" aria-describedby=\"caption-attachment-2418\" style=\"width: 648px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/7-open-solution-file.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2418\" alt=\"open solution file\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/7-open-solution-file.png\" width=\"648\" height=\"367\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/7-open-solution-file.png 648w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/7-open-solution-file-100x56.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/7-open-solution-file-300x169.png 300w\" sizes=\"(max-width: 648px) 100vw, 648px\" \/><\/a><figcaption id=\"caption-attachment-2418\" class=\"wp-caption-text\">Start Visual c++ 2010 Express by itself. Navigate to the solution file from the previous step, and open it.<\/figcaption><\/figure>\n<figure id=\"attachment_2419\" aria-describedby=\"caption-attachment-2419\" style=\"width: 889px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8a-check-sources.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2419\" alt=\"check source locations\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8a-check-sources.png\" width=\"889\" height=\"663\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8a-check-sources.png 889w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8a-check-sources-100x74.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8a-check-sources-300x223.png 300w\" sizes=\"(max-width: 889px) 100vw, 889px\" \/><\/a><figcaption id=\"caption-attachment-2419\" class=\"wp-caption-text\">In the Solution Explorer pane at the left, double click on one of the sources in libpng, and also in zlib. If files do not open, double-check that you have copied files to the right places.<\/figcaption><\/figure>\n<figure id=\"attachment_2420\" aria-describedby=\"caption-attachment-2420\" style=\"width: 604px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8b-solution-properties.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-2420\" alt=\"open up solution properties\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8b-solution-properties-1024x819.png\" width=\"604\" height=\"483\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8b-solution-properties-1024x819.png 1024w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8b-solution-properties-100x80.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8b-solution-properties-300x240.png 300w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8b-solution-properties.png 1280w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/a><figcaption id=\"caption-attachment-2420\" class=\"wp-caption-text\">In this case, I want a Release version, which will be smaller and faster than a Debug one. So right click on the Solution, and open the properties.<\/figcaption><\/figure>\n<figure id=\"attachment_2421\" aria-describedby=\"caption-attachment-2421\" style=\"width: 694px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8c-set-to-release.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2421\" alt=\"set all project targets to release\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8c-set-to-release.png\" width=\"694\" height=\"432\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8c-set-to-release.png 694w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8c-set-to-release-100x62.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/8c-set-to-release-300x186.png 300w\" sizes=\"(max-width: 694px) 100vw, 694px\" \/><\/a><figcaption id=\"caption-attachment-2421\" class=\"wp-caption-text\">Set all of the fields shown to &#8220;Release&#8221;, if they are not already set that way. Important: if you will be linking with code being developed as Debug, you must choose Debug. Basically, this setting must match the code you will be linking to.<\/figcaption><\/figure>\n<figure id=\"attachment_2422\" aria-describedby=\"caption-attachment-2422\" style=\"width: 604px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/9-warnings-as-error.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-2422\" alt=\"warnings treated as errors\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/9-warnings-as-error-1024x685.png\" width=\"604\" height=\"404\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/9-warnings-as-error-1024x685.png 1024w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/9-warnings-as-error-100x66.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/9-warnings-as-error-300x200.png 300w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/9-warnings-as-error.png 1236w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/a><figcaption id=\"caption-attachment-2422\" class=\"wp-caption-text\">If you were to click &#8220;Build Solution&#8221; at this point, you might get errors like this, which are really just warnings, but will cause the build to fail. To fix these, locate the files that are giving warnings, right-click on them, and open properties. (In this case, it is the file, pngvalid.c)<\/figcaption><\/figure>\n<figure id=\"attachment_2423\" aria-describedby=\"caption-attachment-2423\" style=\"width: 752px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/10-set-property-page.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2423\" alt=\"disable warnings as errors\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/10-set-property-page.png\" width=\"752\" height=\"531\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/10-set-property-page.png 752w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/10-set-property-page-100x70.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/10-set-property-page-300x211.png 300w\" sizes=\"(max-width: 752px) 100vw, 752px\" \/><\/a><figcaption id=\"caption-attachment-2423\" class=\"wp-caption-text\">Under configuration properties -&gt; c\/c++ -&gt; General, set &#8220;Treat Warnings as Errors&#8221; to No. Click Apply or OK. You will need to repeat this process on other files generating warnings.<\/figcaption><\/figure>\n<figure id=\"attachment_2424\" aria-describedby=\"caption-attachment-2424\" style=\"width: 604px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/11-test-prog-output-ok.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-2424\" alt=\"successful output\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/11-test-prog-output-ok-1024x656.png\" width=\"604\" height=\"386\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/11-test-prog-output-ok-1024x656.png 1024w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/11-test-prog-output-ok-100x64.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/11-test-prog-output-ok-300x192.png 300w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/11-test-prog-output-ok.png 1233w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/a><figcaption id=\"caption-attachment-2424\" class=\"wp-caption-text\">Click on &#8220;Build Solution&#8221;. As part of the build, the test programs will run to validate that the build was good. You can scroll through the output window if you like, looking for anything that says &#8220;FAIL&#8221;. The output of a successful build is shown here.<\/figcaption><\/figure>\n<figure id=\"attachment_2425\" aria-describedby=\"caption-attachment-2425\" style=\"width: 752px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/12-set-to-static-lib.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2425\" alt=\"set to static lib\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/12-set-to-static-lib.png\" width=\"752\" height=\"531\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/12-set-to-static-lib.png 752w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/12-set-to-static-lib-100x70.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/12-set-to-static-lib-300x211.png 300w\" sizes=\"(max-width: 752px) 100vw, 752px\" \/><\/a><figcaption id=\"caption-attachment-2425\" class=\"wp-caption-text\">The library built above could be used as-is. But I want a static library for libpng, not the one that loads a DLL. Additional steps are required. Right-click on the zlib project, and open Properties. Set the configuration type to &#8220;Static library (.lib)&#8221;<\/figcaption><\/figure>\n<figure id=\"attachment_2426\" aria-describedby=\"caption-attachment-2426\" style=\"width: 752px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/13-set-to-no-runtime.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2426\" alt=\"get rid of Microsoft runtimes\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/13-set-to-no-runtime.png\" width=\"752\" height=\"531\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/13-set-to-no-runtime.png 752w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/13-set-to-no-runtime-100x70.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/13-set-to-no-runtime-300x211.png 300w\" sizes=\"(max-width: 752px) 100vw, 752px\" \/><\/a><figcaption id=\"caption-attachment-2426\" class=\"wp-caption-text\">On the C\/C++ General section on the same page, set the Runtime Library to &#8220;Multi-Threaded (\/MT)&#8221;. This will make the library include everything, so that even Microsoft DLL&#8217;s will not need to be loaded.<\/figcaption><\/figure>\n<figure id=\"attachment_2427\" aria-describedby=\"caption-attachment-2427\" style=\"width: 752px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/14-set-target-machine-to-x86.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2427\" alt=\"set target machine\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/14-set-target-machine-to-x86.png\" width=\"752\" height=\"531\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/14-set-target-machine-to-x86.png 752w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/14-set-target-machine-to-x86-100x70.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/14-set-target-machine-to-x86-300x211.png 300w\" sizes=\"(max-width: 752px) 100vw, 752px\" \/><\/a><figcaption id=\"caption-attachment-2427\" class=\"wp-caption-text\">Optional step. On the Librarian -&gt; General section on the same page, set the Target Machine appropriately. In this picture, it is set to x86, but very possibly, you will want x64 or some other machine.<\/figcaption><\/figure>\n<figure id=\"attachment_2428\" aria-describedby=\"caption-attachment-2428\" style=\"width: 752px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/15-copy-zlib-location.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2428\" alt=\"copy zlib.lib location\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/15-copy-zlib-location.png\" width=\"752\" height=\"531\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/15-copy-zlib-location.png 752w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/15-copy-zlib-location-100x70.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/15-copy-zlib-location-300x211.png 300w\" sizes=\"(max-width: 752px) 100vw, 752px\" \/><\/a><figcaption id=\"caption-attachment-2428\" class=\"wp-caption-text\">On the Librarian -&gt; Command Line section on the same page, highlight and copy the name of the output file. In this case, it is &#8220;D:\\My Documents\\Visual Studio 2010\\Projects\\lpng1626\\projects\\vstudio\\Release\\zlib.lib&#8221; Click Apply and OK.<\/figcaption><\/figure>\n<figure id=\"attachment_2429\" aria-describedby=\"caption-attachment-2429\" style=\"width: 752px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/16-paste-zlib-location-and-set-link-depend.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2429\" alt=\"paste zlib location\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/16-paste-zlib-location-and-set-link-depend.png\" width=\"752\" height=\"531\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/16-paste-zlib-location-and-set-link-depend.png 752w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/16-paste-zlib-location-and-set-link-depend-100x70.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/16-paste-zlib-location-and-set-link-depend-300x211.png 300w\" sizes=\"(max-width: 752px) 100vw, 752px\" \/><\/a><figcaption id=\"caption-attachment-2429\" class=\"wp-caption-text\">Right-click on libpng to open the Properties. Go to Librarian -&gt; General, and under Additional Dependencies, paste in the name copied in the previous step. Set the Link Library Dependencies to Yes. These two actions will force the needed parts of zlib.lib to be incorporated into libpng.lib .<\/figcaption><\/figure>\n<p>While the libpng Properties are open, change them to compile a Static Library, and use the Multi-threaded (Not Mult-threaded dll) models, as was done previously for zlib Properties.<\/p>\n<figure id=\"attachment_2430\" aria-describedby=\"caption-attachment-2430\" style=\"width: 752px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/18-result-location.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2430\" alt=\"location of libpng16.lib\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/18-result-location.png\" width=\"752\" height=\"531\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/18-result-location.png 752w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/18-result-location-100x70.png 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2016\/12\/18-result-location-300x211.png 300w\" sizes=\"(max-width: 752px) 100vw, 752px\" \/><\/a><figcaption id=\"caption-attachment-2430\" class=\"wp-caption-text\">Rebuild the whole solution. If you are unsure where the compiled libraries will be, check the command line under Properties of the libpng project. It should now be possible to take libpng16.lib and use it to compile a program without the need for additional dll&#8217;s. Note that the header files will be required, too.<\/figcaption><\/figure>\n<p>Note: the test programs will need to be adjusted if you want to use them to test the static libraries. \u00a0This is left as an exercise for the reader.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I thought I had a simple request. I wanted to save the contents of a Window in my WINAPI application to a png file. At first, I looked at Gnuwin32 for a precompiled version of libpng for Windows, but found that the version offered was dated, and required use of DLL&#8217;s. So it was necessary &hellip; <a href=\"http:\/\/pididu.com\/wordpress\/blog\/compile-libpng-as-a-static-library-for-windows-with-visual-studio-2010-express\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Compile libpng as a Static Library for Windows with Visual Studio 2010 Express<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[166],"tags":[216,213,214,215,207,205],"_links":{"self":[{"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/posts\/2412"}],"collection":[{"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2412"}],"version-history":[{"count":0,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/posts\/2412\/revisions"}],"wp:attachment":[{"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2412"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}