“在iOS中使用静态库的架构i386的未定义符号”

时间:2012-01-20 11:29:37

标签: iphone xcode4.2 ios-4.2

我正在尝试在xcode 4.2中创建一个静态库。

我正在按照this教程中的步骤进行操作。但是,我收到以下错误:

Ld /Users/harishk/Library/Developer/Xcode/DerivedData/Testlib-ailufzhcoulmzrflyhfgbwqbiksx/Build/Products/Debug-iphonesimulator/Testlib.app/Testlib normal i386
    cd /Users/harishk/Desktop/sl/Testlib
    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/harishk/Library/Developer/Xcode/DerivedData/Testlib-ailufzhcoulmzrflyhfgbwqbiksx/Build/Products/Debug-iphonesimulator -L/Users/harishk/Desktop/sl/Testlib/Testlib/lib -L/Users/harishk/Desktop/sl/Testlib/../lib -L/Users/harishk/Desktop/sl/Testlib -F/Users/harishk/Library/Developer/Xcode/DerivedData/Testlib-ailufzhcoulmzrflyhfgbwqbiksx/Build/Products/Debug-iphonesimulator -filelist /Users/harishk/Library/Developer/Xcode/DerivedData/Testlib-ailufzhcoulmzrflyhfgbwqbiksx/Build/Intermediates/Testlib.build/Debug-iphonesimulator/Testlib.build/Objects-normal/i386/Testlib.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -objC -all_load -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework UIKit -framework Foundation -framework CoreGraphics -lSimpleLibrary -o /Users/harishk/Library/Developer/Xcode/DerivedData/Testlib-ailufzhcoulmzrflyhfgbwqbiksx/Build/Products/Debug-iphonesimulator/Testlib.app/Testlib

ld: warning: ignoring file /Users/harishk/Desktop/sl/lib/libSimpleLibrary.a, file was built for archive which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_MathFunctions", referenced from:
      objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

1 个答案:

答案 0 :(得分:1)

缺少MathFunctions课程。来自您的应用程序项目或您使用的SimpleLibrary.a。确保它是构建的编译和链接步骤的一部分。