Xcode编译报错duplicate symbol _base64Decode in:

如题,我的项目中用到了zBarSDK和微信SDK,然后编译时报错:

duplicate symbol _base64Decode in:
    /Users/Evan/Documents/work-fight/JdysrFight/fightGame/frameworks/runtime-src/proj.ios_mac/ios/wxSDK/libWeChatSDK.a(base64.o)
    /Users/Evan/Library/Developer/Xcode/DerivedData/fightGame-guhgqdxpcitnbxafrzzllmvwrjto/Build/Products/Debug-iphoneos/libcocos2d iOS.a(base64.o)
duplicate symbol _main in:
    /Users/Evan/Library/Developer/Xcode/DerivedData/fightGame-guhgqdxpcitnbxafrzzllmvwrjto/Build/Intermediates/fightGame.build/Debug-iphoneos/fightGame-mobile.build/Objects-normal/arm64/main.o
    /Users/Evan/Library/Developer/Xcode/DerivedData/fightGame-guhgqdxpcitnbxafrzzllmvwrjto/Build/Products/Debug-iphoneos/libcocos2d iOS.a(flatc.o)
ld: 2 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

原因:

意思就是在这两个库中都定义了_base64_encode,编译器认为你重复定义了。至于为什么编译器认为重复定义,个人认为编译器编译全局变量时会根据名字进行编译,会把相同名称的全局变量编译为相同变量,也就是多个编译成一个,而编译器认为这样可能会引起错误,就提醒用户这里有错。

解决方法:

删掉 TARGETS->Build Settings->other linker flag-> -all_load 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值