Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts

    zlib and visual studio 2005

    Given my track record getting questions answered on here, I'm not holding my breath that anyone will reply to this. However, it can't hurt to ask.


    I've run into a strange problem. I compiled zlib using the vs2005 project that comes with the source code into a static lib.

    The static lib is zlib.lib while I also have the normal stub lib zdll.lib, for zlib1.dll that is available in compiled from from the zlib site.


    I made a "Win32 Console" application and used the zlib.lib fine. I then made a "Win32 Project (Empty Project)" application and tried to use zlib.lib and it gave me the following error:
    Code:
    error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)	MSVCRT.lib
    (same again for _free).

    I switched to the dll and it makes the problem go away but I'd really like to use the lib to get rid of the dll, to make distribution of the exe easier (it needs no other dlls at all).

    Does anyone know how I can get rid of this error and use the static lib in my "Win32 Project"?

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Well what are the build option differences between the two projects? Considering the number of different options, it is hard to say which one is causing the issue without looking at them.
    OracleGuy

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    I've been through trying to make them as close as possible to each other but it doesnt seem to be making a difference. I would have thought the linker settings would do it but they already are the same and it still doesn't work.

    They were just the default VS2005 settings for "Win32 Console" and "Win32 Project" (with Empty Project set) and Console worked while Project didn't.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •