添加静态库时链接器错误

时间:2014-06-16 05:07:39

标签: ios objective-c xcode linker linker-errors

我有一个静态库(libMoboSDK.a文件)和一个文件夹(.h文件)。然后尝试添加到我的项目中。当我添加时,我得到了库搜索路径的错误,不确定根本原因。但是当很多搜索时,我试图删除库搜索路径作为stackoverflow上的建议。但在那之后我得到了错误:

ld: library not found for -lMoboSDK clang: error: linker command failed with exit code 1 (use -v to see invocation)

Ld /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboLibfile-dledhcaafocrregpqyxrmoqdaokd/Build/Products/Debug-iphonesimulator/TestMoboLibfile.app/TestMoboLibfile normal i386
cd /Users/nle/Documents/Projects/TestMoboLibfile
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboLibfile-dledhcaafocrregpqyxrmoqdaokd/Build/Products/Debug-iphonesimulator -F/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboLibfile-dledhcaafocrregpqyxrmoqdaokd/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -F/Users/nle/Documents/FacebookSDK -filelist /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboLibfile-dledhcaafocrregpqyxrmoqdaokd/Build/Intermediates/TestMoboLibfile.build/Debug-iphonesimulator/TestMoboLibfile.build/Objects-normal/i386/TestMoboLibfile.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework FacebookSDK -weak_framework AdSupport -weak_framework CoreTelephony -weak_framework StoreKit -weak_framework XCTest -lMoboSDK -framework CoreGraphics -framework UIKit -framework Foundation -lMoboSDK -Xlinker -dependency_info -Xlinker /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboLibfile-dledhcaafocrregpqyxrmoqdaokd/Build/Intermediates/TestMoboLibfile.build/Debug-iphonesimulator/TestMoboLibfile.build/Objects-normal/i386/TestMoboLibfile_dependency_info.dat -o /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboLibfile-dledhcaafocrregpqyxrmoqdaokd/Build/Products/Debug-iphonesimulator/TestMoboLibfile.app/TestMoboLibfile

我尝试了很多研究。但也无法解决问题。这是我的设定: project setting

提前致谢。

更新:经过多次尝试,我得到的错误与stackoverflow上的许多错误描述相同。但也找不到解决方案可以解决我的问题。以下是错误的新描述:

   ld: warning: ignoring file /Users/nle/Documents/Projects/TestMoboLibfile/libMoboSDK.a, missing required architecture i386 in file /Users/nle/Documents/Projects/TestMoboLibfile/libMoboSDK.a (3 slices)
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_MoboSDK", referenced from:
      objc-class-ref in MainViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Ld /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboLibfile-dledhcaafocrregpqyxrmoqdaokd/Build/Products/Debug-iphonesimulator/TestMoboLibfile.app/TestMoboLibfile normal i386
cd /Users/nle/Documents/Projects/TestMoboLibfile
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboLibfile-dledhcaafocrregpqyxrmoqdaokd/Build/Products/Debug-iphonesimulator -L/Users/nle/Documents/Projects/TestMoboLibfile -L/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-dszxjhzvvskuqjfzvsxotqrpwfdr/Build/Products/Debug-iphoneos -L/Users/nle/Documents/Projects/TestMoboLibfile -F/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboLibfile-dledhcaafocrregpqyxrmoqdaokd/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -F/Users/nle/Documents/FacebookSDK -filelist /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboLibfile-dledhcaafocrregpqyxrmoqdaokd/Build/Intermediates/TestMoboLibfile.build/Debug-iphonesimulator/TestMoboLibfile.build/Objects-normal/i386/TestMoboLibfile.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -lMoboSDK -framework FacebookSDK -weak_framework AdSupport -framework CoreTelephony -framework StoreKit -weak_framework XCTest -framework CoreGraphics -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboLibfile-dledhcaafocrregpqyxrmoqdaokd/Build/Intermediates/TestMoboLibfile.build/Debug-iphonesimulator/TestMoboLibfile.build/Objects-normal/i386/TestMoboLibfile_dependency_info.dat -o /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboLibfile-dledhcaafocrregpqyxrmoqdaokd/Build/Products/Debug-iphonesimulator/TestMoboLibfile.app/TestMoboLibfile

0 个答案:

没有答案