Reputation: 763
I am learning C++, and I decided to make a little program that zip/unzip files to train me. I downloaded libzip and zlib and linked them to my compiler (MinGW with Code::Blocks on Windows). So I tried to open my zip file with zip_open() and got an error :
undefined reference to
_imp__zip_open
Here is the code:
#include <zip.h>
#include <zlib.h>
int main()
{
int error(0);
zip *foo = zip_open("foo.zip", 0, &error);
return 0;
}
I don't know where this is coming from and I would really like some help, because I don't find anything on Google (surely cause the problem is simple).
Thanks in advance!
Upvotes: 3
Views: 4606
Reputation: 13421
Judging by the discussion on this thread from the libzip-discuss list it looks like you are trying to link against a static version of libzip but with the preprocessor symbol ZLIB_DLL
defined. You should only have ZLIB_DLL
defined if linking against the dll version.
Upvotes: 1
Reputation: 1804
It looks like you haven't linked to libzip. Make sure you are infact linking to it, and that the path to the lib is in your link path.
Upvotes: 1