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.
这篇关于在每个构建中更改二进制目标文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在每个构建中更改二进制目标文件
基础教程推荐
- 您如何将 CreateThread 用于属于类成员的函数? 2021-01-01
- C++ 标准:取消引用 NULL 指针以获取引用? 2021-01-01
- 设计字符串本地化的最佳方法 2022-01-01
- C++,'if' 表达式中的变量声明 2021-01-01
- 如何定义双括号/双迭代器运算符,类似于向量的向量? 2022-01-01
- 运算符重载的基本规则和习语是什么? 2022-10-31
- 调用std::Package_TASK::Get_Future()时可能出现争用情况 2022-12-17
- C++ 程序在执行 std::string 分配时总是崩溃 2022-01-01
- 如何在 C++ 中处理或避免堆栈溢出 2022-01-01
- 什么是T&&(双与号)在 C++11 中是什么意思? 2022-11-04