use_frameworks引起的Undefined symbols for architecture arm64

简介: use_frameworks引起的Undefined symbols for architecture arm64

OC工程可以使用也可以不使用use_frameworks!,而含有swift的工程必须使用use_frameworks!。

若原来用oc创建的私有库含有extern导入的全局变量或常量会造成该错误。

Undefined symbols for architecture arm64:
  "_sCommonUnitBoldFontHeight", referenced from:
      -[BITUCNNaviView exitBtn] in BITUCNNaviView.o
      -[BITUCNNaviView confirmBtn] in BITUCNNaviView.o
      -[BITUCNNaviView adjustAutoLayout] in BITUCNNaviView.o
  "_sCommonUnitEdgeDistance", referenced from:
      -[BITUCNNaviView adjustAutoLayout] in BITUCNNaviView.o
  "_sCommonUnitFontHeight", referenced from:
      -[BITCMSelectTableViewCell loadData:hideLine:] in BITCMSelectTableViewCell.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

出问题的代码:

//常用字体高度
extern const NSInteger sCommonUnitFontHeight;
//常用字体高度
const NSInteger sCommonUnitFontHeight = 13;

最笨的解决方案,直接把私有库拖入工程,然后修改头文件的包含方式。

正确的库是:

探索通过建立一个公用的私有库,它依赖其它私有库,结果问题仍旧存在。

正探索其它通用导入方式的可行性。利用test导入工程,然后手动增加私有库。

target 'DYLiangXinApp' do
  # Comment the next line if you don't want to use dynamic frameworks


  # Pods for DYLiangXinApp
  use_frameworks!
  
  # 数据
    pod 'AFNetworking'
    pod 'MJExtension'


end

target 'DYLiangXinAppTests' do
  # Comment the next line if you don't want to use dynamic frameworks


  # Pods for DYLiangXinApp
  
  pod 'DYVideoPlayer'

end

目录
相关文章
|
1月前
|
iOS开发
部分库不支持32位系统archive报错:Undefined symbols for architecture armv7
部分库不支持32位系统archive报错:Undefined symbols for architecture armv7
21 0
|
1月前
|
Swift
swift相关项目包含私有库引起的Undefined symbols for architecture arm64
swift相关项目包含私有库引起的Undefined symbols for architecture arm64
25 0
|
1月前
|
开发工具 iOS开发 Perl
mac电脑升级到10.15.7含有支付宝SDK的组件更新报错:AlipaySDK.framework/AlipaySDK for architecture arm64
mac电脑升级到10.15.7含有支付宝SDK的组件更新报错:AlipaySDK.framework/AlipaySDK for architecture arm64
26 0
undefined reference to symbol 'dlsym@@GLIBC_2.17' libdl.so: error adding symbols: DSO missing from c
undefined reference to symbol 'dlsym@@GLIBC_2.17' libdl.so: error adding symbols: DSO missing from c
452 0
|
1月前
|
Linux
L1 Cache architecture in ARM
L1 Cache architecture in ARM
49 0
|
iOS开发 MacOS
Qt 报错:Undefined symbols for architecture arm64
MacBook Pro Apple M1 使用 Qt 6.4.1 的时候碰到的报错,做了不同的尝试,最后解决了这个报错。
581 0
|
开发工具 iOS开发 Perl
iOS开发 - undefined symbols for architecture x86_64,大多数都是缺少静态库,缺少静态库分下面几种
iOS开发 - undefined symbols for architecture x86_64,大多数都是缺少静态库,缺少静态库分下面几种
161 0
iOS开发 - undefined symbols for architecture x86_64,大多数都是缺少静态库,缺少静态库分下面几种
MAC编译出错:Undefined symbols for architecture x86_64: “_CFRelease“, referenced from:
MAC编译出错:Undefined symbols for architecture x86_64: “_CFRelease“, referenced from:
171 0
|
1月前
|
JavaScript
JS中Null和Undefined的区别及用法
JS中Null和Undefined的区别及用法
22 1
|
1月前
|
JavaScript 前端开发 算法
undefined与null的区别
在JavaScript中,undefined和null都表示变量未被赋值或值缺失,但它们在使用场景上有一些区别。 - **`语义不同`**:undefined表示一个变量未被赋值或者声明后未进行初始化。而null表示一个变量被明确地设置为无值或者表示空值的概念。 - **`类型不同`**:undefined是一种基本数据类型,而null是一个引用类型。 - **`条件判断`**:在条件判断中,使用if (variable === undefined)或者if (variable === null)可以进行区分。