Clang: Undefined symbols, but it is there using nm.

Xcode 链接动态框架解决方法
本文介绍了一种在Xcode中使用clang链接动态框架或dylib时遇到未嵌入依赖的问题解决办法。通过设置-Wl,-undefined,dynamic_lookup到OTHER_LDFLAGS并确保搜索路径正确配置来解决undefined symbols的问题。

https://stackoverflow.com/questions/36662920/xcode-clang-link-build-dynamic-framework-or-dylib-not-embed-dependencies

 

clang use ld command to make the final link, I checked the manual and found -U and -undefinedcan ignore undefined symbols.

-U symbol_name 

Specified that it is ok for symbol_name to have no definition. With two_levelnamespace, the resulting symbol will be marked dynamic_lookup which means dyld will search all loaded images.

-undefined treatment

Specifies how undefined symbols are to be treated. Options are: error, warning, suppress, or dynamic_lookup. The default is error.

So the final solution is set -Wl,-undefined,dynamic_lookup to OTHER_LDFLAGS, also make sure search path set correctly. It works.

 

转载于:https://www.cnblogs.com/lilei9110/p/6179585.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值