gpt4 book ai didi

c - 架构 arm64 xcode 7.3 的 undefined symbol

转载 作者:搜寻专家 更新时间:2023-11-01 05:36:29 25 4
gpt4 key购买 nike

我创建了一个带有简单数学函数的静态库,并用它构建了一个通用二进制文件。 Build for active architectures only 在构建时设置为 NO。

lipo -info libcheckC.a
Architectures in the fat file: libcheckC.a are: armv7 x86_64 arm64

我已将此文件添加到另一个项目并验证其他链接器标志有 -ObjC、-lcheckC、$(inherited)

该库也存在于“构建阶段 --> 将二进制文件与库链接”下。

我已经创建了桥接头并将头文件添加到我的项目中。

还是报错

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

最佳答案

您是否在库搜索路径中添加了库的路径?

enter image description here

关于c - 架构 arm64 xcode 7.3 的 undefined symbol ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38195987/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com