c++ - 强制忽略重复符号?

标签 c++ c macos ld

我正在从使用静态库的项目中构建一些遗留代码。现在,我收到很多这样的错误:

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.

关于c++ - 强制忽略重复符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5669328/

相关文章:

c++ - 使用 UDP 连接到服务器

c++ - 为什么我的程序在启动前就崩溃了?

c - Pro*C 到 C : cast to pointer from integer of different size [-Wint-to-pointer-cast] and note: in definition of macro 'TEND'

macos - dateFormatter 在瑞典返回 nil 的 NSDate

javascript - meteor中的flash插件让相机正常工作

c++ - 如何使用 Boost.Assign 初始化 Boost.PropertyTree

c++ - Direct3D c++ api 如何更新顶点缓冲区?

c++ - 通过存储指向成员函数的指针的虚拟行为

c++ - 如何将文件存储在可执行文件中

excel - 在 Excel Visual Basic 中比较两个工作表