binary object file changing in each build(在每个构建中更改二进制目标文件)
问题描述
在每次构建时使用 G++ GNU 编译器进行编译时,在不更改源代码的情况下,我会得到一个不同的二进制目标文件.是否有一个编译选项每次都会给我相同的二进制文件.
When compiling using G++ GNU compiler every time I do a build, without changing source code I get a different binary object file. Is there a compile option that will give me the same binary each time.
推荐答案
复制自 GCC 手册页:
Copied from the GCC man-page:
-frandom-seed=字符串
此选项提供 GCC 使用的种子,否则使用随机数.它是用于生成某些必须不同的符号名称在每个编译的文件中.它也用于在覆盖数据文件中放置唯一的标记以及产生的目标文件他们.您可以使用 -frandom-seed 选项生成可重现的相同目标文件.
-frandom-seed=string
This option provides a seed that GCC uses when it would otherwise use random numbers. It is used to generate certain symbol names that have to be different in every compiled file. It is also used to place unique stamps in coverage data files and the object files that produce them. You can use the -frandom-seed option to produce reproducibly identical object files.
您编译的每个文件的字符串应该不同.
The string should be different for every file you compile.
这篇关于在每个构建中更改二进制目标文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在每个构建中更改二进制目标文件
基础教程推荐
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 初始化列表*参数*评估顺序 2021-01-01
- CString 到 char* 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
