简体   繁体   中英

ImageIO linker error?

Trying to ready metadata (eg kCGImagePropertyExifBodySerialNumber or kCGImagePropertyExifLensModel ) from images using ImageIO framework.

Unfortunately during the compilation linker has a trouble:

Undefined symbols for architecture x86_64:
"_kCGImagePropertyExifBodySerialNumber", referenced from:
      -[AppDelegate applicationDidFinishLaunching:] in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

ImageIO/CGImageProperties.h is of corurse imported, and ImageIO.framework is included on the list "Linked Frameworks and Libraries" in target configuration.

It happends only when I'm trying to use kCGImagePropertyExifBodySerialNumber or kCGImagePropertyExifLensModel . It the same project kCGImagePropertyExifFocalLength , kCGImagePropertyExifExposureTime are used without any problems

Any ideas ?

Those constants seem to not be defined in the SDK versions of the ImageIO framework. You can check this yourself with the following command:

nm /Volumes/Applications/Developer\ Tools/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ImageIO.framework/imageio | grep -F kCGImagePropertyExifBodySerialNumber 

(Edit the path to Xcode as appropriate.)

I'm on a Lion machine at the moment, and the system version of the same framework does have it:

 % nm /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ImageIO.framework/imageio | grep -F kCGImagePropertyExifBodySerialNumber 00000000000e4898 s _kCGImagePropertyExifBodySerialNumber 

So, I suggest filing a bug and then, as a workaround, unsetting SDKROOT (“Base SDK”) in your project's build settings. With no SDK set, it should use the frameworks and headers of the system you're building on.

The downside of that workaround is that if you're using anything introduced on Mountain Lion, you won't be able to build on Lion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM