Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LibPNG static linking with VS2012 64bit

I can't manage to link LibPNG statically to my VS2012(64bit) project. I did the following:

  1. Download libPNG source code for the latest version(1614).
  2. Open the enclosed VisualStudio solution (projects/vstudio/vstudio.sln).
  3. Select "Release Library" and set C/C++ -> Code Generation ->Runtime Library to "MDd" (same as in my project.

    4.Compile static lib.

Then in the target project in the linker I specify in Additional Library directories the location of the lib and in the Input the name of the lib.

I also configured Zlib to be static as is proposed here.

Yet,when compiling I am getting :

error LNK2019: unresolved external symbol png_sig_cmp referenced in function

For the very first function call to LibPNG API.

I have tried to tweak different properties of the lib but it doesn't work.Can it happen because the libPNG built as x86 lib and not x64?

like image 357
Michael IV Avatar asked Jan 17 '26 10:01

Michael IV


1 Answers

So to sum up the comments, the solution here was to compile libPNG in 64bit mode.

You cannot compile 32bit assembly with 64bit assembly.

like image 52
SatA Avatar answered Jan 20 '26 02:01

SatA



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!