c++ - 二进制目标文件在每次构建中发生变化

标签 c++ g++

在每次构建时使用 G++ GNU 编译器进行编译时,在不更改源代码的情况下,我会得到一个不同的二进制目标文件。是否有编译选项每次都会给我相同的二进制文件。

最佳答案

从 GCC 手册页复制:

-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++ - 二进制目标文件在每次构建中发生变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4140329/

相关文章:

c++ - 嵌套循环,在 C++ 赋值介绍中向后移动

c++ - 如何在 Windows 上获取父进程 ID

c++ - OpenGL GL_LINE_STRIP 在 glEnd 之后给出错误 1281(无效值)

C++ 程序,用 g++ 编译

c++ - 为什么通过 weak_ptr 调用这么慢?

c++ - 原始数据类型的包装类

c++ - 将 vector 传递给带有指针参数的函数的问题c++

c++ - 无法插入到 std::map (G++)

c++ - usr/bin/ld : cannot find -l<nameOfTheLibrary>

c++ - fatal error : freetype/config/ftheader. h