c++visual-studiogzipunresolved-external

Why am I getting error LNK2001 when linking to zlib.lib?


I'm working on a project that already contains the gzip library as follows:

zlib\zlib.h  
zlib\zlib.lib
zlib\zconf.h  

I would like to use the gzip functions from this .lib but am getting the following errors:

Compress.cpp
Linking...
Compress.obj : error LNK2001: unresolved external symbol _gzclose
Compress.obj : error LNK2001: unresolved external symbol _gzerror
Compress.obj : error LNK2001: unresolved external symbol _gzwrite
Compress.obj : error LNK2001: unresolved external symbol _gzopen
.\Debug/files.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.  

The link settings include:
Object/library modules: zlib.lib
Project Options:
zlib.lib

In the file using the gzX() functions, it

#include "zlib/zlib.h"

What else needs to be done here to use these functions?

EDIT: Using Visual Studio 6.0 C++

EDIT2: It turned out the static library I was using had the gz() functions taken out of them. The header file still had them which was misleading.


Solution

  • I grabbed the one off here to get zlib to build in windows. If you did the same, you may have forgotten to #define ZLIB_WINAPI before including zlib.h