我想鏈接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構建)。
這是表示該庫的內容一些輸出被鏈接:
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
HessianKit.framework在哪裏?也許你需要指定一個框架的路徑? (在clang命令行上是-F)。 通過進入目標設置,選擇Build Phases,然後在Compile Sources部分選擇HessianKit文件,點擊return並且出現一個對話框,您可以禁用特定文件的ARC。輸入'-fno-objc-arc'。 –
邁克,非常感謝您的評論!我將HessianKit.framework目錄添加到構建選項中(花了我幾分鐘的時間纔得到它),現在有一個-F開關用於使用正確的路徑(錯誤的路徑產生警告)。但是,鏈接器失敗仍然存在。 –
禁用ARC的「技巧」工作得很好,所以我現在可以直接嵌入HessianKit!謝謝! ;-) –