Compile library with Visual Studio is not always easy if those have not been designed for Windows. This is the case for libexif.

Homepage : http://libexif.sourceforge.net/

Version used : 0.6.1

Steps :

  • Download and uncompress the source code
  • Create a win32 folder in the source tree (the one containing libexif, contrib, po,…)
  • Create a Visual Studio project in this folder (select the .lib template)
  • Add all files in libexif/ with the subfolders
  • Download a copy from config.h written by Anthony Lawrence from https://github.com/alawrence/c_LibExifModule/blob/master/libexif-0.6.20/win32/lib_exif/config.h
  • Modify it with your libexif version, and with the other changes you may want
  • Be carefull to exclude from include and lib paths any existing libexif installation
  • Add ‘.’ and ‘..’ in your include paths (to find config.h and <libexif/*>)
  • Modify the file exif-entry.c on the line 1384 (unsigned short *utf16 = exif_mem_alloc (e→priv→mem, e→size+sizeof(unsigned short));) and move to the beginning of the scope the declaration of utf16 variable (line 833 : unsigned short *utf16;)
  • Add preprocessor definitions : GETTEXT_PACKAGE=“libexif-12”;LOCALEDIR=
  • And lastly, modify options according to that you need ; in my case (for RPhoto) :
    • Unicode
    • Set to MultiThread (/MT)
    • Static Library

It should compile and link well now.