除"extern"外,符号乘法定义的可能原因 [英] Possible reasons for symbol multiply defined other than 'extern'

查看:63
本文介绍了除"extern"外,符号乘法定义的可能原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了没有在.h中声明,将其作为'extern'并在.cpp中实现之外,是否有其他原因需要符号乘法定义"?

Is there any reasons for 'symbol multiply defined' other than not having the declaration in .h, having it as 'extern', and have the implementation in .cpp?

我很确定我的所有文件都遵循规则,但是我收到了这样的错误消息:

I'm pretty sure that all my files follow the rule, but I'm getting an error message like this:

ld: lto: could not merge in /Users/zlw/Library/Developer/Xcode/DerivedData/Wireless -  
amjmgyrircjezdhegioctszbcypz/Build/Intermediates/Wireless.build/Debug/Wireless.build/Objects 
normal/x86_64/qam.o because 'Linking globals named '_Z12SNRFromSNRdBd': symbol multiply 
defined!', using libLTO version 'LLVM version 3.3svn, from Apple Clang 5.0 (build 
500.2.76)' for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

消息是否表示所有麻烦都与"qam.h"或"qam.cpp"有关?

Is the message means that all the troubles have something to do with 'qam.h' or 'qam.cpp'?

除了'extern'以外,还有其他原因吗?还是有什么方法可以查看我在Xcode中的代码出了什么问题?

Is there any reasons other that 'extern' or is there any ways to see what is wrong with my code in Xcode?

非常感谢!

推荐答案

它表示在编译 qam.cpp 时,会使用名为 _Z12SNRFromSNRdBd 的符号(对应于 SNRFromSNRdB(double))定义了多次.

it says that when you compile qam.cpp, you use a symbol named _Z12SNRFromSNRdBd (corresponding to SNRFromSNRdB(double)) which is defined more than once.

您应该搜索该功能以及实现该功能的人.

You should search for that function and who is implementing it.

注意:要将混杂的名称"转换为可读的格式,可以使用c ++ filt

Note : to convert from "mangled name" to human readable, you can use c++filt

bruce@lorien:~$ c++filt _Z12SNRFromSNRdBd
SNRFromSNRdB(double)

这篇关于除"extern"外,符号乘法定义的可能原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆