我创建了一个具有简单数学函数的静态库,并使用它构建了一个通用二进制文件。构建此时,仅将活动体系结构的构建设置为NO。
lipo -info libcheckC.a
Architectures in the fat file: libcheckC.a are: armv7 x86_64 arm64
我已将此文件添加到另一个项目并验证了该文件 其他链接器标志有-ObjC,-lcheckC,$(继承)
该库也出现在“Build Phases - > Link binary with libraries”下。
我创建了桥接头并将头文件添加到我的项目中。
我仍然收到错误
Undefined symbols for architecture arm64:
"_squareOf", referenced from:
checkCLib.ViewController.calculate (__ObjC.UIButton) -> () in ViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我正在使用Xcode 7.3
当我手动尝试该命令时,我触发了以下内容 - 从Xcode复制并添加-v并从那里更深入。我得到以下细节。
@(#)PROGRAM:ld PROJECT:ld64-264.3.101
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS)
Library search paths:
/Users/test/Library/Developer/Xcode/DerivedData/Build/Products/Release-universal/
/Users/test/Documents/MyIApps/checkCLib/checkCLib
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/usr/lib
Framework search paths:
/Users/test/Library/Developer/Xcode/DerivedData/Build/Products/Release-universal/
/Users/test/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/
Undefined symbols for architecture arm64:
"_squareOf", referenced from:
checkCLib.ViewController.calculate (__ObjC.UIButton) -> () in ViewController.o
ld: symbol(s) not found for architecture arm64
该库存在于上述路径中,包含符号并支持该体系结构。
lipo -info /Users/test/Library/Developer/Xcode/DerivedData/Build/Products/Release-universal/libcheckC.a
Architectures in the fat file: /Users/test/Library/Developer/Xcode/DerivedData/Build/Products/Release-universal/libcheckC.a are: armv7 x86_64 arm64
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm /Users/test/Library/Developer/Xcode/DerivedData/Build/Products/Release-universal/libcheckC.a
/Users/test/Library/Developer/Xcode/DerivedData/Build/Products/Release-universal/libcheckC.a(square.o):
0000000000000000 T _sqaureOf