I've been trying to compile an application which utilizes zlib compression in VC++ 2010.
I get the
error LNK2019: unresolved external symbol _inflateInit2_ referenced in function ...
error message, which wouldn't be unusual if I didn't link the lib. I link the static release zlib library.
I've managed to get this exact same configuration of libs and headers working perfectly in different solutions and hence this behavior is greatly unexpected.
Any ideas will be appreciated.
UPDATE: Linker command line
/OUT:"C:Documents and SettingsSuthkeMy DocumentsVisual Studio 2010ProjectsSBRapGen2DebugSBRapGen2.exe" /INCREMENTAL /NOLOGO "zlib.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"DebugSBRapGen2.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:Documents and SettingsSuthkeMy DocumentsVisual Studio 2010ProjectsSBRapGen2DebugSBRapGen2.pdb" /SUBSYSTEM:CONSOLE /PGD:"C:Documents and SettingsSuthkeMy DocumentsVisual Studio 2010ProjectsSBRapGen2DebugSBRapGen2.pgd" /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE
UPDATE 2: Verbose linker output:
1>------ Build started: Project: SBRapGen2, Configuration: Release Win32 ------
1>
1> Starting pass 1
1> Processed /DEFAULTLIB:uuid.lib
1> Processed /DEFAULTLIB:msvcprt
1> Processed /DEFAULTLIB:zlib.lib
1> Processed /DEFAULTLIB:MSVCRT
1> Processed /DEFAULTLIB:OLDNAMES
1>
1> Searching libraries
1> Searching C:Program FilesMicrosoft Visual Studio 10.0VClibzlib.lib:
1> Searching C:Program FilesMicrosoft SDKsWindowsv7.0Alibkernel32.lib:
1> Searching C:Program FilesMicrosoft SDKsWindowsv7.0Alibuser32.lib:
1> Searching C:Program FilesMicrosoft SDKsWindowsv7.0Alibgdi32.lib:
1> Searching C:Program FilesMicrosoft SDKsWindowsv7.0Alibwinspool.lib:
1> Searching C:Program FilesMicrosoft SDKsWindowsv7.0Alibcomdlg32.lib:
1> Searching C:Program FilesMicrosoft SDKsWindowsv7.0Alibadvapi32.lib:
1> Searching C:Program FilesMicrosoft SDKsWindowsv7.0Alibshell32.lib:
1> Searching C:Program FilesMicrosoft SDKsWindowsv7.0Alibole32.lib:
1> Searching C:Program FilesMicrosoft SDKsWindowsv7.0Aliboleaut32.lib:
1> Searching C:Program FilesMicrosoft SDKsWindowsv7.0Alibuuid.lib:
1> Searching C:Program FilesMicrosoft SDKsWindowsv7.0Alibodbc32.lib:
1> Searching C:Program FilesMicrosoft SDKsWindowsv7.0Alibodbccp32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 10.0VClibmsvcprt.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 10.0VClibMSVCRT.lib:
1> Found @__security_check_cookie@4
1> Referenced in SBRapGen2.obj
1> Loaded MSVCRT.lib(secchk.obj)
1> Found __imp__sprintf
1> Referenced in SBRapGen2.obj
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp__ceil
1> Referenced in SBRapGen2.obj
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp__free
1> Referenced in SBRapGen2.obj
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp__malloc
1> Referenced in SBRapGen2.obj
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp__printf
1> Referenced in SBRapGen2.obj
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp__fopen
1> Referenced in SBRapGen2.obj
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp__fread
1> Referenced in SBRapGen2.obj
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp__fwrite
1> Referenced in SBRapGen2.obj
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp__ftell
1> Referenced in SBRapGen2.obj
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp__fseek
1> Referenced in SBRapGen2.obj
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp__fclose
1> Referenced in SBRapGen2.obj
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found _mainCRTStartup
1> Loaded MSVCRT.lib(crtexe.obj)
1> Found ___report_gsfailure
1> Referenced in MSVCRT.lib(secchk.obj)
1> Loaded MSVCRT.lib(gs_report.obj)
1> Found ___security_cookie
1> Referenced in MSVCRT.lib(secchk.obj)
1> Referenced in MSVCRT.lib(gs_report.obj)
1> Loaded MSVCRT.lib(gs_cookie.obj)
1> Found __IMPORT_DESCRIPTOR_MSVCR100
1> Referenced in MSVCRT.lib(MSVCR100.dll)
1> Referenced in MSVCRT.lib(MSVCR100.dll)
1> Referenced in MSVCRT.lib(MSVCR100.dll)
1> Referenced in MSVCRT.lib(MSVCR100.dll)
1> Referenced in MSVCRT.lib(MSVCR100.dll)
1> Referenced in MSVCRT.lib(MSVCR100.dll)
1> Referenced in MSVCRT.lib(MSVCR100.dll)
1> Referenced in MSVCRT.lib(MSVCR100.dll)
1> Referenced in MSVCRT.lib(MSVCR100.dll)
1> Referenced in MSVCRT.lib(MSVCR100.dll)
1> Referenced in MSVCRT.lib(MSVCR100.dll)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found ___CxxSetUnhandledExceptionFilter
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(unhandld.obj)
1> Found __amsg_exit
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp____getmainargs
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __dowildcard
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(wildcard.obj)
1> Found __newmode
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(_newmode.obj)
1> Found _atexit
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(atonexit.obj)
1> Found __RTC_Terminate
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(_initsect_.obj)
1> Found __imp___cexit
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp___exit
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __XcptFilter
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp__exit
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp____initenv
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __IsNonwritableInCurrentImage
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(pesect.obj)
1> Found __initterm
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found ___xc_a
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(cinitexe.obj)
1> Processed /DEFAULTLIB:kernel32.lib
1> Processed /DISALLOWLIB:libcmt.lib
1> Processed /DISALLOWLIB:libcmtd.lib
1> Processed /DISALLOWLIB:msvcrtd.lib
1> Found __initterm_e
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found ___native_startup_state
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(natstart.obj)
1> Found __SEH_epilog4
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Referenced in MSVCRT.lib(atonexit.obj)
1> Loaded MSVCRT.lib(sehprolg4.obj)
1> Found __except_handler4
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Referenced in MSVCRT.lib(atonexit.obj)
1> Referenced in MSVCRT.lib(pesect.obj)
1> Referenced in MSVCRT.lib(sehprolg4.obj)
1> Loaded MSVCRT.lib(chandler4gs.obj)
1> Found __imp___configthreadlocale
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found ___globallocalestatus
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(xthdloc.obj)
1> Found __setdefaultprecision
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(fp8.obj)
1> Found __imp____setusermatherr
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __matherr
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(merr.obj)
1> Found __setargv
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(dllargv.obj)
1> Found __commode
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(xncommod.obj)
1> Found __imp___commode
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp___fmode
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __fmode
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(xtxtmode.obj)
1> Found __imp____set_app_type
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found ___security_init_cookie
1> Referenced in MSVCRT.lib(crtexe.obj)
1> Loaded MSVCRT.lib(gs_support.obj)
1> Found __crt_debugger_hook
1> Referenced in MSVCRT.lib(gs_report.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __NULL_IMPORT_DESCRIPTOR
1> Referenced in MSVCRT.lib(MSVCR100.dll)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found MSVCR100_NULL_THUNK_DATA
1> Referenced in MSVCRT.lib(MSVCR100.dll)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found "void __cdecl terminate(void)" (?terminate@@YAXXZ)
1> Referenced in MSVCRT.lib(unhandld.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __unlock
1> Referenced in MSVCRT.lib(atonexit.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found ___dllonexit
1> Referenced in MSVCRT.lib(atonexit.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __lock
1> Referenced in MSVCRT.lib(atonexit.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __imp___onexit
1> Referenced in MSVCRT.lib(atonexit.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __except_handler4_common
1> Referenced in MSVCRT.lib(chandler4gs.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __invoke_watson
1> Referenced in MSVCRT.lib(fp8.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Found __controlfp_s
1> Referenced in MSVCRT.lib(fp8.obj)
1> Loaded MSVCRT.lib(MSVCR100.dll)
1> Searching C:Program FilesMicrosoft Visual Studio 10.0VClibOLDNAMES.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 10.0VClibzlib.lib:
1> Searchi