强制忽略重复的符号
Force ignore duplicate symbols?
本文关键字:符号 更新时间:2023-10-16
我正在构建一些使用静态库的项目遗留代码。现在,我得到了很多这样的错误:
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.
试试。也许它能解决你的问题。
相关文章:
- 在C++中,将大的无符号浮点数四舍五入为整数的最佳方法是什么
- 有符号的int和int-有没有一种方法可以在C++中区分它们
- 将无符号char*转换为std::istream*C++
- 如何在C++中将一个无符号的 int 转换为两个无符号的短裤?
- vscode g++链路故障:体系结构x86_64的未定义符号
- 从矢量<无符号字符>转换为字符* 包括垃圾数据
- 如何理解将半精度指针转换为无符号长指针和相关的内存对齐
- Visual studio代码重构似乎不起作用(例如,重命名符号-f2)
- 使用gcc从静态链接的文件中查找可选符号
- C++中无符号字符溢出
- 使用无符号字符数组有效存储内存
- C++:Application.cpp中抛出了未解析的外部符号(解决方案在问题的末尾,供未来的读者参考)
- VC++本机单元测试,找不到调试符号
- 为什么我必须在C++中添加一个赋值符号来声明一个数组
- 检查TCHAR数组输入是否为带符号整数C++
- 用符号版本替换对函数的所有调用
- 未解析的外部符号_MsiLocateComponentW@12.
- 如何打印boost多精度128位无符号整数
- C++模板函数,用于比较任何无符号整数和有符号整数
- 在 Mac 上使用 CMAKE 将 FFTW 和 FFTWPP 链接到项目中时未定义的符号