Friday, December 21, 2012

Building and Installing Exiv2 on Visual Studio 2010

Exiv2 is a C++ library and a command line utility to manage image metadata. It provides fast and easy read and write access to the Exif (Exchangeable image file format), IPTC and XMP metadata of images in various formats. Exiv2 is available as free software and with a commercial license, and is used in many projects.

I have spent more than 2 hours to build this library on Visual Studio 2010. So I think it's better if I wrote the steps that I have followed to build the libraries.

Exiv2 has two main dependencies. One is expat and the other is zlib. The important thing here is finding the suitable versions of these two dependencies. To successfully compile Exiv2 we need following versions of expat and zlib.
Steps:
  • First create a folder in any place you like. I have created a folder named “gnu” in “C:\” drive.
  • Put all three folders which you got from extracting and put them inside the folder “gnu”.
image
My Folder : "C:\gnu"
image
C:\gnu\exiv2
image
C:\gnu\expat-2.0.1
image
C:\gnu\zlib-1.2.3
  • Open the “expat.dsw” inside the folder “expat-2.0.1”. Visual Studio 2010 will convert everything to latest project files and say "Yes" to everything.
  • Go to Batch Build and select the following and Build. Please note that if you try to build the whole solution you will get many errors. So you should only build the following.
    • expat-Debug
    • expat-Release
    • expat_static-Debug
    • expat_static-Release
image
Batch Build
image
Batch Build Selection
image
Build
  • Open the “zlib.dsw” inside the folder “zlib-1.2.3\projects\visualc6”. Again Visual Studio 2010 will convert everything to latest project files and say "Yes" to everything.
  • Go to Batch Build and select the following and Build. Please note that if you try to build the whole solution you will get many errors. So you should only build the following.
    • zlib-DLL Debug
    • zlib-DLL Release
    • zlib-LIB Debug
    • zlib-LIB Release
image
Batch Build Selection
image
Build
  • Now open the “exiv2.sln” inside the folder “exiv2\msvc”. Again Visual Studio 2010 will convert everything to latest project files and say "Yes" to everything. when Visual Studio has completed converting, select the project “exiv2lib”. Right click on it and select properties.
image
exiv2lib
image
exiv2lib Properties
image
exiv2lib Properties -> General
  • Only for this project, target name should changed as follows.
    • Debug           - exiv2sd
    • DebugDLL    - exiv2d
    • Release         - exiv2s
    • ReleaseDLL  - exiv2
image
Debug -> exiv2sd
image
DebugDLL -> exiv2d
image
Release -> exiv2s
image
ReleaseDLL -> exiv2
  • Now you can build the project without any errors.
image
Build
I have uploaded all the needed files to my skydrive and you can download it from there.


Happy Coding.

Regards,
Jaliya