1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

LNK1104 error - DEBUG vs. RELEASE

Discussion in 'MFC' started by Xarx, Aug 30, 2010.

  1. Xarx

    Xarx New Member

    Aug 30, 2010
    Likes Received:
    Trophy Points:

    I'm compiling a DEBUG version of my application that links to RELEASE version of zlib.lib. The linker command-line contains reference to "..\..\bin\zlib.lib", however the linker reports:

    LINK : fatal error LNK1104: cannot open file 'zlibd.lib'

    That is, the linker looks for the debug version of the library instead of for the release version. How to fix it?

    - The command line parameters for link.exe read (according to the build log):

    /OUT:"W:\trunk\Debug\PdfServiceLib.dll" /INCREMENTAL /LIBPATH:"W:\trunk\Debug\..\bin" /DLL /MANIFEST /MANIFESTFILE:"Debug\PdfServiceLib.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /ASSEMBLYDEBUG /PDB:"W:\trunk\Debug\PdfServiceLib.pdb" /SUBSYSTEM:WINDOWS /DYNAMICBASE:NO /FIXED:No /MACHINE:X86 "..\..\bin\toolsud.lib" "..\..\bin\zlib.lib"

    - It seems however, that the problem is caused by the C++ compiler, not by the linker, as the reference to "zlibd.lib" is already contained in the "stdafx.obj" and "PdfServiceLib.pch" files. In particular, these .obj and .pcb files contain the strings
    /DEFAULTLIB:"zlibd.lib", /DEFAULTLIB:"toolsud.lib" (and the same for various system libraries)

    - In project dependencies, the PdfServiceLib.dll project depends on the Zlib project. In Configuration manager, Zlib is marked as Release.

    - The Zlib project does not use the "_DEBUG" macro anywhere.

    - My configuration: Visual C++ 2008 on Windows XP Professional SP3.

    Thank you,


Share This Page