Friday, May 06, 2005

LNK2019 when compilng libpng 1.25 with VS2003

When compile the libpng project, I got the following linking errors:
Linking...
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
png.obj : error LNK2019: unresolved external symbol _crc32 referenced in function _png_reset_crc
png.obj : error LNK2019: unresolved external symbol _inflateReset referenced in function _png_reset_zstream
pngpread.obj : error LNK2001: unresolved external symbol _inflateResetpngrutil.obj : error LNK2001: unresolved external symbol _inflateReset
pngpread.obj : error LNK2019: unresolved external symbol _inflate referenced in function _png_process_IDAT_data
When I search the Google, I got an answer from Kobi Ben Tzvi. In short, I must make the libpng project dependent on zlib project through Project menu-> Project Dependencies.

What is ERROR LNK2005?

Hi, I am trying to compile an open-source project named Vovida. It compiles cleanly, but when I get to linking, it gives me this:

Linking...
libcpmt.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in sdp2.lib(Sdp2Session.obj)obj.nodebug.Win32.i686/ua.exe : fatal error LNK1169: one or more multiply defined symbols foundError
executing link.exe.

I have searched the google and got the answer - the project setting in "sdp2" is different from the one in "ua", one is single-threaded, the other one is multithreaded. When I change the "sdp2" project to use the multithreaded run-time library, the compilation is successful.