Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with zip_open from libzip

Tags:

c++

zip

zlib

unzip

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!

like image 647
Tiwenty Avatar asked Jan 22 '26 02:01

Tiwenty


1 Answers

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.

like image 57
krsteeve Avatar answered Jan 23 '26 16:01

krsteeve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!