开发者

exiflib with MSVC++

开发者 https://www.devze.com 2023-02-03 04:00 出处:网络
I\'m new to exiflib. I have downloaded the exiflib source file (libexif-0.6.20.zip), and included in my VC++ project. When I tried to build, it produces some linker errors,

I'm new to exiflib. I have downloaded the exiflib source file (libexif-0.6.20.zip), and included in my VC++ project. When I tried to build, it produces some linker errors,

unresolved ext开发者_如何学Pythonernal symbol _exif_entry_get_value, symbol _exif_format_get_name ..

Any help will be greatly appreciated..


To get libexif compiling in MSVC++ is a bit of a hack job. It uses functions that MSVC has chosen not to implement. See my working example VS2010 project below (if you don't like downloading files then skip to my explanation of what needed changing to get it to work below):

https://www.dropbox.com/s/l6wowl8pouux01a/libexif-0.6.21_CompiledInVS2010%2BExample.7z?dl=0

To elaborate, the issues that needed a "hack" (as hinted in the LibExif readme-win32.txt documentation) are:

  • Libexif uses inline in several places which is not defined in VS for C, only C++ (see this)

  • Libexif uses snprintf which is not defined in VS (see here)

  • You need to create the config.h yourself without a ./configure command to help you. You could read through the script but most of it doesn't make sense for Windows VS2010.

  • You will need to define GETTEXT_PACKAGE because it's probably setup in the configure file. I just choose UTF-8, whether that is correct or not I'm not sure.

  • There was a random unsigned static * that needed to be moved from a .c file to the .h file as C in VS doesn't allow you to create new variables inside functions in the particular way they were trying to do.

Once you have fixed the above issues your unresolved external symbols issues should disappear.

0

精彩评论

暂无评论...
验证码 换一张
取 消