Search code examples
c++zipzlibunzip

Error with zip_open from libzip


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!


Solution

  • 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.