【问题标题】:ImageIO linker error?ImageIO 链接器错误?
【发布时间】:2012-12-16 21:10:35
【问题描述】:

尝试使用 ImageIO 框架从图像中准备元数据(例如 kCGImagePropertyExifBodySerialNumberkCGImagePropertyExifLensModel)。

不幸的是在编译期间链接器出现了问题:

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 已被导入,ImageIO.framework 包含在目标配置的“链接框架和库”列表中。

仅当我尝试使用 kCGImagePropertyExifBodySerialNumberkCGImagePropertyExifLensModel 时才会发生这种情况。使用同一个项目kCGImagePropertyExifFocalLength,kCGImagePropertyExifExposureTime没有任何问题

有什么想法吗?

【问题讨论】:

    标签: objective-c macos cocoa linker javax.imageio


    【解决方案1】:

    这些常量似乎没有在 ImageIO 框架的 SDK 版本中定义。您可以使用以下命令自行检查:

    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 
    

    (根据需要编辑 Xcode 的路径。)

    我现在在Lion机器上,同框架的系统版本确实有:

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

    因此,我建议filing a bug,然后作为一种解决方法,在项目的构建设置中取消设置 SDKROOT(“Base SDK”)。如果没有设置 SDK,它应该使用您正在构建的系统的框架和头文件。

    该解决方法的缺点是,如果您使用在 Mountain Lion 上引入的任何东西,您将无法在 Lion 上构建。

    【讨论】:

    • Symbol 在 10.7 SDK 和 10.8 SDK 中都不可用,但是在系统库(我运行的是 10.8.2)中可以找到。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-16
    • 2015-08-04
    • 2012-08-12
    • 2012-06-30
    • 2016-03-31
    • 2010-09-20
    相关资源
    最近更新 更多