Skip to main content
Topic: zlibstat.lib error compiling makeobj and Simutrans (Read 23892 times) previous topic - next topic

zlibstat.lib error compiling makeobj and Simutrans

Sorry if that's a noob question but when compiling makeobj and Simutrans I get this error in Visual Studio:

Quote
LINK : fatal error LNK1104: cannot open file 'zlibstat.lib'

What I need to do, this file exists and is on utils folder

--------------------------------------------
EDIT
OK It was really a noob question, I found out by myself
Just copied given file to trunk folder.

Re: zlibstat.lib error compiling makeobj and Simutrans

Reply #1
You have to add the directory, where zlibstat.lib is located, to the project:

Properties -> Compiler -> Additional Include Directories
Properties -> Linker -> Additional Library Directories
Parsley, sage, rosemary, and maggikraut.

Re: zlibstat.lib error compiling makeobj and Simutrans

Reply #2
Thanks Dwachs,
but I'm getting some different errors can you help me?

Makeobj
Code: [Select]
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
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 _inflateReset
pngrutil.obj : error LNK2001: unresolved external symbol _inflateReset
pngpread.obj : error LNK2019: unresolved external symbol _inflate referenced in function _png_push_read_zTXt
pngread.obj : error LNK2001: unresolved external symbol _inflate
pngrutil.obj : error LNK2001: unresolved external symbol _inflate
pngread.obj : error LNK2019: unresolved external symbol _inflateInit_ referenced in function _png_create_read_struct_2
pngread.obj : error LNK2019: unresolved external symbol _inflateEnd referenced in function _png_read_destroy
pngwrite.obj : error LNK2019: unresolved external symbol _deflate referenced in function _png_write_flush
pngwutil.obj : error LNK2001: unresolved external symbol _deflate
pngwrite.obj : error LNK2019: unresolved external symbol _deflateEnd referenced in function _png_write_destroy
pngwutil.obj : error LNK2019: unresolved external symbol _deflateReset referenced in function _png_write_compressed_data_out
pngwutil.obj : error LNK2019: unresolved external symbol _deflateInit2_ referenced in function _png_write_IHDR
C:\Simutrans SVN\trunk\Debug\Makeobj.exe : fatal error LNK1120: 9 unresolved externals

Simutrans
Code: [Select]
LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
bzlib.obj : error LNK2005: _BZ2_bz__****ertH__fail already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzCompressInit@16 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzCompress@8 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzCompressEnd@4 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzDecompressInit@12 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_indexIntoF already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzDecompress@4 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzDecompressEnd@4 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzWriteOpen@20 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzWrite@16 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzWriteClose@20 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzWriteClose64@28 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzReadOpen@24 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzReadClose@8 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzRead@16 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzReadGetUnused@16 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzBuffToBuffCompress@28 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzBuffToBuffDecompress@24 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzlibVersion@0 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzopen@8 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzdopen@8 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzread@12 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzwrite@12 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzflush@4 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzclose@4 already defined in bzlib.obj
bzlib.obj : error LNK2005: _BZ2_bzerror@8 already defined in bzlib.obj
LIBCMTD.lib(_file.obj) : error LNK2005: ___iob_func already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(fflush.obj) : error LNK2005: _fflush already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(handler.obj) : error LNK2005: "int (__cdecl*__cdecl _set_new_handler(int (__cdecl*)(unsigned int)))
(unsigned int)" (?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z) already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in
MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(vsprintf.obj) : error LNK2005: _vsprintf already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(printf.obj) : error LNK2005: _printf already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(typinfo.obj) : error LNK2005: "public: char const * __thiscall type_info::_name_internal_method(struct
__type_info_node *)const " (?_name_internal_method@type_info@@QBEPBDPAU__type_info_node@@@Z) already
defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(typinfo.obj) : error LNK2005: "public: void __thiscall type_info::_type_info_dtor_internal_method(void)" (?
_type_info_dtor_internal_method@type_info@@QAEXXZ) already defined in MSVCRTD.lib(MSVCR100D.dll)
LIBCMTD.lib(typinfo.obj) : error LNK2005: "private: __thiscall type_info::type_info(cl**** type_info const &)" (??
0type_info@@AAE@ABV0@@Z) already defined in MSVCRTD.lib(ti_inst.obj)
LIBCMTD.lib(typinfo.obj) : error LNK2005: "private: cl**** type_info & __thiscall type_info::operator=(cl**** type_info
const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in MSVCRTD.lib(ti_inst.obj)
LIBCMTD.lib(typname.obj) : error LNK2005: ___clean_type_info_names_internal already defined in MSVCRTD.lib
(MSVCR100D.dll)
LIBCMTD.lib(tolower.obj) : error LNK2005: _tolower already defined in MSVCRTD.lib(MSVCR100D.dll)
MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: __fileno already defined in LIBCMTD.lib(fileno.obj)
MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: __fdopen already defined in LIBCMTD.lib(fdopen.obj)
MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: __setmode already defined in LIBCMTD.lib(setmode.obj)
MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: __stricmp already defined in LIBCMTD.lib(stricmp.obj)
MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: __strnicmp already defined in LIBCMTD.lib(strnicmp.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
bzlib.obj : error LNK2001: unresolved external symbol _BZ2_compressBlock
bzlib.obj : error LNK2001: unresolved external symbol _BZ2_compressBlock
bzlib.obj : error LNK2001: unresolved external symbol _BZ2_decompress
bzlib.obj : error LNK2001: unresolved external symbol _BZ2_decompress
bzlib.obj : error LNK2001: unresolved external symbol _BZ2_rNums
bzlib.obj : error LNK2001: unresolved external symbol _BZ2_rNums
bzlib.obj : error LNK2001: unresolved external symbol _BZ2_crc32Table
bzlib.obj : error LNK2001: unresolved external symbol _BZ2_crc32Table
LIBCMTD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
C:\Simutrans SVN\trunk\Debug\Simutrans.exe : fatal error LNK1120: 5 unresolved externals

Re: zlibstat.lib error compiling makeobj and Simutrans

Reply #3
Please install all libraries. There is a readme.txt and a documentation in the trunk. Did you actually read it?

You need to install for simutrans:
libbzip2
libz

And for makeobj you need
libpng

You can get them from the openttd-bundle, that is the easiest way.

Re: zlibstat.lib error compiling makeobj and Simutrans

Reply #4
Yes I read it, and they are installed, I'll look again I'm sure i did a **** somewhere ;) Trying to compile too fast never works, I'm sure I needed to be more patient :-[

Re: zlibstat.lib error compiling makeobj and Simutrans

Reply #5
You may also need to compile bzip2 library yourself.

Re: zlibstat.lib error compiling makeobj and Simutrans

Reply #6
Course, just compiled right now, seconds before your post.
Now looking Simutrans project to compile it.

Re: zlibstat.lib error compiling makeobj and Simutrans

Reply #7
Can't find what I'm doing wrong. Tried to compile makeobj and got error asking for libpng.lib, then I opened the project file from libpng compiled it and the lib file was created, linked it in makeobj and now it give this errors:

Code: [Select]
libpng.lib(pngread.obj) : error LNK2019: unresolved external symbol _inflateInit_ referenced in function _png_create_read_struct_2
libpng.lib(pngread.obj) : error LNK2019: unresolved external symbol _inflate referenced in function _png_read_row
libpng.lib(pngrutil.obj) : error LNK2001: unresolved external symbol _inflate
libpng.lib(pngread.obj) : error LNK2019: unresolved external symbol _inflateEnd referenced in function _png_read_destroy
libpng.lib(png.obj) : error LNK2019: unresolved external symbol _crc32 referenced in function _png_reset_crc
libpng.lib(png.obj) : error LNK2019: unresolved external symbol _inflateReset referenced in function _png_reset_zstream
libpng.lib(pngrutil.obj) : error LNK2001: unresolved external symbol _inflateReset

Re: zlibstat.lib error compiling makeobj and Simutrans

Reply #8
libpng needs libz itself, too.

Re: zlibstat.lib error compiling makeobj and Simutrans

Reply #9
you talking about when compiling libpng?

Re: zlibstat.lib error compiling makeobj and Simutrans

Reply #10
Both. If you compile libpng you need the zlib headers in the include path, and if you link libpng to something, you also must link libz.

Libpng uses libz for (de)compressing the images.

Re: zlibstat.lib error compiling makeobj and Simutrans

Reply #11
But I'm linking zlib and libpng in makeobj project. That's what I can't undestand.

zlib and libz are the same thing or it's different?

Re: zlibstat.lib error compiling makeobj and Simutrans

Reply #12
In the end they're the same thing - lib just says what it is, the actual name is only "z" ;)

In theory you could have problems if the program wanted to link against one kind of zlib and libpng against another. I don't remember the specifics but IIRC it's possible to get this in some form... If you downloaded libpng which was built against one instance (?) of zlib and compiled zlib yourself, it might be such a case... I have always used both from the from openttd essentials pack.


edit: sorry, I edited this while you posted. It might be nonsense.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

 

Re: zlibstat.lib error compiling makeobj and Simutrans

Reply #13
Even if I link the same zlib I used to create libpng.lib?
That's really strange. :P I'll try find something.
But can someone send me a compiled version for me? I'm running Windows.