[Solved] Trying to use libzip

Hi all!
I am learning C++ and decided to make a little program to train me.
It will be a program that zip/unzip files and moves them to another folder.
I decided to use libzip. I compiled zlib and libzip with ./configure, make and make install in Cygwin. I linked libz.a, libzip.a and libzip.dll.a to my compiler and added the folder of zconf.h, zip.h, zlib.h and zipconf.h to the search directories. And I put this code:

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <zip.h>

int main()
{
    int err = 0;
    zip *z(NULL);
    z = zip_open("foo.zip", ZIP_CREATE, &err);
    zip_close(z);
    std::cout << "Hello world!" << std::endl;
    return 0;
}

When I launch it for the first time, it says that I don't have cygzip-2.dll, cygwin1.dll, cygz.dll and cyggcc_s-1.dll. I put them in my executable folder. Now it launches. But I have this status error: -1073741819.
When I remove the zip_open and zip_close, it works well and I see the Hello world.

I use Code::Blocks and MinGW to compile (with Cygwin it does the same error). I hope I didn't forget a detail and that you can help me soon (I am trying to zip/unzip for 2 weeks ^^')

Thanks!

EDIT: When I try to compile my program *IN* Cygwin, it says 'undefined reference to '_zip_open'' and 'undefined reference to '_zip_close''. Probably something is missing, but what?

EDIT2: I already tried CMake, but desperately, I retried it. And then I saw an option to make a C::B project! I braved the errors and finally built my 2 libraries! My problem is now solved!
Last edited on
Topic archived. No new replies allowed.