【问题标题】:Compiler Error in Xcode-4 Cocoa Application For GData Api?GData Api 的 Xcode-4 Cocoa 应用程序中的编译器错误?
【发布时间】:2012-03-01 14:04:08
【问题描述】:

我正在尝试从 Cocoa 应用程序上的 YouTube 频道获取视频。为此,首先将 GData 框架添加到我的项目中,然后导入 #import "GData/GData.h"。那么他们是没有错误的。但如果我正在导入 #import "GData/GDataServiceGoogleYouTube.h"

并编写一些与 GDataServiceGoogleYouTube 相关的代码

 GDataServiceGoogleYouTube *service=[[GDataServiceGoogleYouTube alloc]init]; 

得到编译器错误:

    Ld /Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth/Build/Products/Debug/YouTube.app/Contents/MacOS/YouTube normal x86_64
        cd /Users/Rasheed/Desktop/MULTIPLESOCKET/YouTube
        setenv MACOSX_DEPLOYMENT_TARGET 10.6
        /Developer/usr/bin/clang -arch x86_64 -isysroot 
/Developer/SDKs/MacOSX10.6.sdk -L/Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth/Build/Products/Debug
 -F/Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth/Build/Products/Debug -filelist 
/Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth

/Build/Intermediates/YouTube.build/Debug/YouTube.build/Objects-normal/x86_64/YouTube.LinkFileList -mmacosx-version-min=10.6 -ObjC
 -lxml2 -all_load -framework Cocoa -o /Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth/Build
/Products/Debug/YouTube.app/Contents/MacOS/YouTube

    Undefined symbols for architecture x86_64:
      "_OBJC_CLASS_$_GDataServiceGoogleYouTube", referenced from:
          objc-class-ref in YouTubeAppDelegate.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

我该如何解决这个错误?

【问题讨论】:

    标签: objective-c xcode cocoa gdata


    【解决方案1】:

    如果您构建了 GData 静态库,请确保该库已列在目标“构建阶段”选项卡下的“链接二进制与库”部分中。

    如果您将所有 GData 源文件拖到项目中,请确保它们都列在目标“构建阶段”选项卡下的“编译源”部分中。

    您可能会发现这篇博文很有帮助:http://hoishing.wordpress.com/2011/08/23/gdata-objective-c-client-setup-in-xcode-4/

    【讨论】:

    • 在目标依赖项下只有一项,即 GDataFramework(Gdata)
    • 那么您是否将其添加到“Link Binary With Libraries”部分?
    • 是的,我在“Link Binary With Libraries”部分添加了 GData.Framework 和 libGDataTouchstaticlib.a。
    • 这是可可应用,所以我认为不需要添加 libGDataTouchstaticlib.a
    • 大概你不需要链接 both GData.frameworklibGDataTouchstaticlib.a。但是你需要链接一些包含GDataServiceGoogleYouTube 类的库。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-30
    • 2011-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多