AIX 6.1:警告:重复符号:
我正忙于将用 C 编写的应用程序从 Solaris SPARC 10 移植到 AIX 6.1。
我收到大量“警告:重复符号:
”错误。我尝试使用 #ifndef 仅在需要时包含头文件,但仍然得到相同的重复项。
有什么想法会导致这种情况吗?我看过类似的帖子,但还没有具体的内容。
作为一个例子,我得到:
ld: 0711-224 WARNING: Duplicate symbol: onCheckCallbackFunc
ld: 0711-224 WARNING: Duplicate symbol: onCommitCallbackFunc
ld: 0711-224 WARNING: Duplicate symbol: onConfirmCallbackFunc
ld: 0711-224 WARNING: Duplicate symbol: onRollbackCallbackFunc
ld: 0711-224 WARNING: Duplicate symbol: onMessageArrivedCallbackFunc
如果我在该库上运行以下命令:
nm -X64 ./libtest.so
我得到以下内容(只是一个片段)
onCheck:F-1 - 692
onCheckCallbackFunc B 536877592 8
onCheckCallbackFunc d 536877064 8
onCheckCallbackFunc:G820 - 0
onCommit D 536876400
onCommit d 536876400 24
onCommit d 536877024 8
onCommit:F-1 - 824
onCommitCallbackFunc B 536877600 8
onCommitCallbackFunc d 536877072 8
onCommitCallbackFunc:G820 - 0
onConfirm D 536876424
onConfirm d 536876424 24
onConfirm d 536877032 8
onConfirm:F-1 - 956
onConfirmCallbackFunc B 536877608 8
onConfirmCallbackFunc d 536877080 8
onConfirmCallbackFunc:G820 - 0
为什么符号在上面重复?
再次感谢
林顿
I am busy porting an application written in C from Solaris SPARC 10 to AIX 6.1.
I am getting huge amounts of "WARNING: Duplicate symbol:
" errors. I have tried using #ifndef
to only include header files if needed, but still getting the same duplicates.
Any ideas what would cause this? I have seen similar posts but nothing concrete yet.
As an example I am getting:
ld: 0711-224 WARNING: Duplicate symbol: onCheckCallbackFunc
ld: 0711-224 WARNING: Duplicate symbol: onCommitCallbackFunc
ld: 0711-224 WARNING: Duplicate symbol: onConfirmCallbackFunc
ld: 0711-224 WARNING: Duplicate symbol: onRollbackCallbackFunc
ld: 0711-224 WARNING: Duplicate symbol: onMessageArrivedCallbackFunc
And if I run the following command on that lib:
nm -X64 ./libtest.so
I get the following( just a snippet)
onCheck:F-1 - 692
onCheckCallbackFunc B 536877592 8
onCheckCallbackFunc d 536877064 8
onCheckCallbackFunc:G820 - 0
onCommit D 536876400
onCommit d 536876400 24
onCommit d 536877024 8
onCommit:F-1 - 824
onCommitCallbackFunc B 536877600 8
onCommitCallbackFunc d 536877072 8
onCommitCallbackFunc:G820 - 0
onConfirm D 536876424
onConfirm d 536876424 24
onConfirm d 536877032 8
onConfirm:F-1 - 956
onConfirmCallbackFunc B 536877608 8
onConfirmCallbackFunc d 536877080 8
onConfirmCallbackFunc:G820 - 0
Why are symbols being duplicated above?
Thanks again
Lynton
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
链接器尝试链接包含同名对象的对象文件。
假设您没有使用相同的名称显式声明不同的对象,这种情况很可能是通过将相同的源编译到不同的对象文件而发生的,然后这些对象文件又全部传递给链接器。
发生这种情况的常见情况是让编译器多次 #include 某些源。
另一种可能的情况是,您从相同的源创建两个库,并尝试将它们都链接到您的主对象。
或者您将源代码包含到库中并到主构建中。
在任何此类情况下,链接器都会阻塞。
The linker tries to link object files containing objects with the same name.
Assuming you did not explcitly declared different objects using the same name, this happens most probably by compiling the same source to different object files which then in turn are all passed over to the linker.
A common case for this to happen is to let the compiler #include some sources more then once.
Another possible scenario is that you create two libraries out of the same sources and try to link them both to your main object.
Or you include sources into a library and into the main build.
In any such cases the linker wil choke.