CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2015
    Posts
    4

    Exclamation ZLIB Linker Errors

    I have used Zlib many times including the source code within the project. This time however I want to link using an external DLL. In Project settings I have the header fil directory added and the directory for the lib as well as including the lib for the dependency. In the source I am including zlib.h which has all of the exports defined under extern "C" I checked the DLL's def file and sure enough the functions are in the LIB. I am using the LIB from the ZLib's site but I also compiled the DLL myself when I came across the linking failure and I received the same result which is.

    error LNK2001: unresolved external symbol gzread
    error LNK2001: unresolved external symbol gzclose
    error LNK2001: unresolved external symbol gzopen

    I may have to go back to just building the project with the source code if I cant get this resolved but I would rather find a solution since it would best meet this projects needs. I am building on ZLib 1.2.8 and x64 Visual C++ 2008 V9 Professional

    Any help would be greatly appreciated. This is really holding up my project.

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: ZLIB Linker Errors

    Quote Originally Posted by RedRobNHood View Post
    This time however I want to link using an external DLL.
    When you want to link with external dll, you actually link with import library properly made for the dll. Otherwise you have to manually resolve at runtime any symbol in use.
    Best regards,
    Igor

  3. #3
    Join Date
    May 2015
    Posts
    4

    Re: ZLIB Linker Errors

    I am actually a retired programmer so yes, I am quite aware of how to link to external libraries but thank you all the same for the reply. Anyway, I did find the problem it was not with the library I compiled myself with the ZLib source code it was with the masm that the library was calling. After compiling that with ml64 it linked fine however the library required msvc90 to be present and after adding that I started getting runtime crashes so instead I just wen back to including the source within the current project. It works fie as it has in the past an don't have to waste any more time on it.

  4. #4
    Join Date
    May 2015
    Posts
    4

    Re: ZLIB Linker Errors

    Also you may have misunderstood the post. As I had stated the DLL was created under the same build configuration as the current project so that was not the problem the problem was the assembly that it was calling was not and since I never built a DLL using ZLIBs source I wasn't aware of the assembly being called. The projects for ZLIb are created by contributors and ZLIB itself doesn't require the assembly so I never thought to look for it.

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: ZLIB Linker Errors

    Quote Originally Posted by RedRobNHood View Post
    Also you may have misunderstood the post.
    Definitely I did. Your first post was about unresolved external symbols from zlib. I don't see how this could be connected with the absence of msvc90. Nevertheless, whatever it was, I glad you solved that.
    Best regards,
    Igor

  6. #6
    Join Date
    May 2015
    Posts
    4

    Re: ZLIB Linker Errors

    Neither did I but than again I did not write the zlib code and am not interested in devoting time to debug it. I thought it was a bit peculiar myself. The reason I thought you misunderstood is because I clearly stated I was linking to the import library and not directly to the DLL I apologize for any misunderstanding. Thanks anyway for your help.

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured