Compilation & Integration

Compiling for different implementations and platforms

The files required for all the library versions are located in the program root directory. You also need to copy additional files to the library root directory from the two more subfolders. Depending on the configuration these files are located in:

Windows MFC

\Windows and \mfc
You can just execute _copy from Win-MFC.bat batch file.

Windows STL

\Windows and \stl
You can just execute _copy from Win-STL.bat batch file.

Linux (STL version)

\Linux and \stl
You can just execute _copy_from_Linux.sh script file (don't forget to set executable rights before e.g. with the command: chmod +x _copy_from_Linux.sh ).

Note:
If you are compiling under FreeBSD, Mac, you need to comment include of sys/vfs.h in ZipPlatform.cpp and uncomment includes of sys/param.h and sys/mount.h.

On some systems (m68k and the SPARC) when you want to compile the library for dynamic linking you need to modify makefile files (for the zlib and ZipArchive) so that CFLAGS have -fPIC option set.

Visual C++ : integrating with the project

To add ZipArchive library functionality into your project you need to link the library to the project. You can do this at least in two ways (in both cases you need to include ZipArchive.h header in your sources).

Method 1

Add ZipArchive.lib with the proper path e.g. ..\ZipArchive\debug\ZipArchive.lib to

VS 6.0
Project Settings->Link->Input->Object/library modules
VS 2003 and VS 2005
Project Properties->Linker->Input->Additional Dependencies
and add ZipArchive library directory to the preprocessor searches

VS 6.0
Project Settings -> C++ -> Preprocessor -> Additional include directories
VS 2003 and VS 2005
Project Properties -> C/C++ -> General -> Additional include directories

Method 2 (simpler)

VS 6.0
Insert Zip project into workspace and set project dependencies: your project dependent on ZipArchive project ( Project -> Dependencies ). On the dialog that will appear you select your project name from the combo box and check the box next to ZipArchive project name.
VS 2003 and VS 2005
Set your project to reference the ZipArchive project (on the Solutions Explorer).
When you use this method, you link configurations in your project with configurations in the ZipArchive project that have the same name in both projects. So if you need to use for example "Debug" configuration from ZipArchive project, you need to create one with the same name in your application project and make sure that your project uses MFC library and run-time library in same way.

VS 6.0
Project->Settings->General->Microsoft Fundation Classes and Project->Settings-> C/C++ ->Code Generation->Use run-time library
VS 2003 and VS 2005
Project Properties->General->Use of MFC and Project Properties-> C/C++ ->Code Generation->Runtime library

DLL version

When you're using the DLL version of the ZipArchive library, you need to define in your program ZIP_HAS_DLL e.g. in:
VS 6.0
Project Settings -> C++ -> Preprocessor -> Preprocessor definitions
VS 2003 and VS 2005
Project Properties -> C/C++ -> Preprocessor -> Preprocessor definitions
Only for VS 6.0
Apart from integrating the ZipArchive library with your program (use one of the methods above), you also need to take into account zlib.lib file (use zlib/zlib.dsw to create it and add to preprocessor includes) or zlib/zlib.dsw project (insert into workspace and set ZipArchive project dependent on it).
Files ZipArchive.dll and zlib.dll (the last one only when you were compiling using Visual Studio 6.0 projects) must be available for the program when running (e.g. in the program's directory).

You can read about linking problems in the FAQ.

Borland C++ compatibility

Project files for Borland C++ 5.0 are available. They were created using Visual C++ Project Conversion Utility (VCTOBPR.EXE). You can start this tool with the command Tools->Visual C++ Project Conversion Utility .

Note:
Be sure to create Release subfolder before compiling one of these projects, otherwise you'll get a write error.
In case the projects provided don't work for you, you can create your own. You need to copy to the root directory appropriate files for MFC or STL versions. You may use the Borland project conversion utility.

There are also makefiles available which should work with other versions of Borland.

Compiling the sample application

There is a Borland C++ project available for the sample application ZipArc.
To compile it you need compiled MFC version of ZipArchive library.

Note:
Be sure to create Release subfolder first, otherwise you'll get a write error.
Add the library (ZipArchive.lib ) to the project (Project->Add To Project) and compile.

If you wish to convert Visual C++ project using Visual C++ Project Conversion Utility then after converting to properly compile the application you need to remove odbccp32.lib from the project file and comment everything out in ZipArc_TLB.cpp or remove this file from the project files.

Linux platform

Notes

Usage

When using the library under Linux you should be aware of a few things:

Compiling

Compiling the library and liniking with the application

Notes

STL version

Compiling as DLL

[Windows only]

MFC sample application (ZipArc)

MFC sample application using ZipArchive library is available separately. Main features:
ZipArchive Copyright © 2000 - 2006 Tadeusz Dracz . Generated at Fri Apr 7 13:55:25 2006.