2012-01-19 108 views
1

我想鏈接HessianKit與簡單的Xcode iOS測試項目。 我嘗試了不同的構建配置。 我將-ObjC開關添加到庫項目和我的主項目的鏈接器命令行中。HessianKit鏈接失敗

這是從主項目中的命令行:

Ld /Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Products/Debug-iphonesimulator/MatthiasSimpleTest.app/MatthiasSimpleTest normal i386 
cd /Users/wuttke/Documents/MatthiasSimpleTest 
setenv MACOSX_DEPLOYMENT_TARGET 10.6 
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" 
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Products/Debug-iphonesimulator -L/Users/wuttke/Documents/MatthiasSimpleTest/MatthiasSimpleTest -L/Users/wuttke/Documents/MatthiasSimpleTest -F/Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Products/Debug-iphonesimulator -F/Users/wuttke/Documents/MatthiasSimpleTest -filelist /Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Intermediates/MatthiasSimpleTest.build/Debug-iphonesimulator/MatthiasSimpleTest.build/Objects-normal/i386/MatthiasSimpleTest.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework UIKit -framework Foundation -framework CoreGraphics -framework HessianKit -o /Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Products/Debug-iphonesimulator/MatthiasSimpleTest.app/MatthiasSimpleTest 

這從連接體的錯誤消息:

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

我連接並顯示該項目的屏幕截圖(它包含HessianKit.framework ,我們爲i386/MacOS,iOS 5.0構建)。

Screenshot Failure

這是表示該庫的內容一些輸出被鏈接:

Tobiass-MacBook-Pro:HessianKit.framework wuttke$ pwd 
/Users/wuttke/Documents/MatthiasSimpleTest/HessianKit.framework 
Tobiass-MacBook-Pro:HessianKit.framework wuttke$ ls 
Headers  HessianKit Resources Versions 
Tobiass-MacBook-Pro:HessianKit.framework wuttke$ nm -arch i386 HessianKit | grep CWHessianConnection 
000010a0 t +[CWHessianConnection proxyWithURL:protocol:] 
00001020 t -[CWHessianConnection initWithHessianVersion:] 
000011a0 t -[CWHessianConnection proxyWithURL:protocol:] 
00001260 t -[CWHessianConnection setVersion:] 
00001240 t -[CWHessianConnection version] 
0000d000 S .objc_class_name_CWHessianConnection 

我發現的建議,嘗試直接與該項目包括HessianKit文件。由於ARC導致編譯錯誤。

你有什麼建議可以嘗試嗎?提前致謝。

Matthias

+1

HessianKit.framework在哪裏?也許你需要指定一個框架的路徑? (在clang命令行上是-F)。 通過進入目標設置,選擇Build Phases,然後在Compile Sources部分選擇HessianKit文件,點擊return並且出現一個對話框,您可以禁用特定文件的ARC。輸入'-fno-objc-arc'。 –

+0

邁克,非常感謝您的評論!我將HessianKit.framework目錄添加到構建選項中(花了我幾分鐘的時間纔得到它),現在有一個-F開關用於使用正確的路徑(錯誤的路徑產生警告)。但是,鏈接器失敗仍然存在。 –

+0

禁用ARC的「技巧」工作得很好,所以我現在可以直接嵌入HessianKit!謝謝! ;-) –

回答

0

我是Xcode的新手,能夠解決這個問題。我正在嘗試在我正在開發的一個項目中使用HessianKit。

的解決問題的辦法在這個崗位描述:https://stackoverflow.com/a/7866167/1366367

顯然,iPhone模擬器要求圖書館建成爲I386架構不的ARMv7

這爲我工作:

  1. 打開項目HessianKit(從SourceForge下載)
  2. 組基本SDK上HessianKit目標iphonesimulator
  3. 清除基地SDK爲StaticHessianKit目標(應該默認爲iphonesimulator )
  4. 運行內部版本
  5. 查找libStaticHessianKit.a在〜/ Library/Develope r/Xcode/DerivedData/*/Build/Products/Debug-iphonesimulator文件夾
  6. 將libStaticHessianKit.a拖放到您的項目中。這應該自動設置庫搜索路徑。
  7. 將HessianKit框架文件夾拖放到您的項目中。
  8. 確保你,你正在使用HessianKit導入此:

    #import <HessianKit/HessianKit.h> 
    

好運。

+0

非常感謝! ;-)應該很明顯,它必須是i386。 –