如何解决强制忽略重复的符号?
| 我正在从使用静态库的项目中构建一些旧代码。现在,我收到很多这样的错误:ld: warning: option -m is obsolete and being ignored
ld: duplicate symbol <function name>
有没有办法强制完成构建。从我可以看到的“重复”功能是相同的,只是构建过程变得麻烦了。该项目确实很大(以及一堆遗留的C和C ++代码),我真的想避免花费大量时间来研究构建过程。是否有“快速修复”?我真的只需要运行一次该程序,这样我就可以解决(某些)稳定性问题。
解决方法
在GNU
ld
手册页中:
--allow-multiple-definition
-z muldefs
Normally when a symbol is defined multiple times,the linker will
report a fatal error. These options allow multiple definitions and
the first definition will be used.
,在我的系统上以man ld
进行搜索(“ \\ duplicate \”),结果是:
--traditional-format
For some targets,the output of ld is different in some ways from
the output of some existing linker. This switch requests ld to use
the traditional format instead.
For example,on SunOS,ld combines duplicate entries in the symbol
string table. This can reduce the size of an output file with full
debugging information by over 30 percent. Unfortunately,the SunOS
\"dbx\" program can not read the resulting program (\"gdb\" has no
trouble). The --traditional-format switch tells ld to not combine
duplicate entries.
尝试一下。也许它可以解决您的问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。