2

I want to add libarchive to my app to be able to extract tar.gz.

As install instruction says, I took following steps:

  • cmake -G "Xcode" ~/libarchive-download-dir/
  • make
  • make install

Now I have a libarchive.14.dzlib file. I added it to the project, and wants to call i.e. the following, like proposed in examples

r = archive_read_open_filename(a, "archive.tar", 10240);

but, method is not declared.

enter image description here

I guess I have to add a header to the project?! It is a dylib, I am not sure. But I do not found any appropriate header file in the build folder.

How can I use libarchive, what am I missing to call one method, which methods are available where is a header?

enter image description here

János
  • 32,867
  • 38
  • 193
  • 353

3 Answers3

2

Yes, you need to add the header. The archive.h header that is in the libarchive directory is sufficient, you don't need the other ones.

deadbeef
  • 5,409
  • 2
  • 17
  • 47
  • are you sure archive.h is enough? http://stackoverflow.com/questions/33367979/libarchive-raise-compiler-error – János Oct 27 '15 at 12:31
1

Looks like you've simply forgotten to include the header file and so the compiler assumes any undefined functions return int.

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
0

If you correctly downloaded libarchive sources, they should include source .cpp and .h files - look here https://github.com/libarchive/libarchive/tree/master/libarchive

nredko
  • 136
  • 4