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

目录
相关文章
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
499 0
|
4月前
|
iOS开发
部分库不支持32位系统archive报错:Undefined symbols for architecture armv7
部分库不支持32位系统archive报错:Undefined symbols for architecture armv7
36 0
|
4月前
|
Swift
swift相关项目包含私有库引起的Undefined symbols for architecture arm64
swift相关项目包含私有库引起的Undefined symbols for architecture arm64
41 0
|
4月前
|
开发工具 iOS开发 Perl
mac电脑升级到10.15.7含有支付宝SDK的组件更新报错:AlipaySDK.framework/AlipaySDK for architecture arm64
mac电脑升级到10.15.7含有支付宝SDK的组件更新报错:AlipaySDK.framework/AlipaySDK for architecture arm64
64 0
|
4月前
|
Linux
L1 Cache architecture in ARM
L1 Cache architecture in ARM
91 0
|
iOS开发 MacOS
Qt 报错:Undefined symbols for architecture arm64
MacBook Pro Apple M1 使用 Qt 6.4.1 的时候碰到的报错,做了不同的尝试,最后解决了这个报错。
649 0
|
开发工具 iOS开发 Perl
iOS开发 - undefined symbols for architecture x86_64,大多数都是缺少静态库,缺少静态库分下面几种
iOS开发 - undefined symbols for architecture x86_64,大多数都是缺少静态库,缺少静态库分下面几种
171 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:
200 0
|
1月前
|
存储 JavaScript 前端开发
成功解决:Cannot read properties of undefined (reading ‘commit‘)
这篇文章提供了解决Vuex中"Cannot read properties of undefined (reading 'commit')"错误的两种方法:检查模板中的数据属性是否存在,以及确保在Vue实例中正确挂载了store对象。
成功解决:Cannot read properties of undefined (reading ‘commit‘)
|
1月前
|
定位技术 Apache
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
31 0

热门文章

最新文章