c++ - 检测二进制文件的 GCC 编译时标志

标签 c++ c gcc

有没有办法找出特定二进制文件编译时使用的 gcc 标志?

最佳答案

快速查看 GCC 文档并没有发现任何问题。

Boost 人员是一些最聪明的 C++ 开发人员,他们 resort到命名conventions因为这通常是不可能的任何其他方式(可执行文件可以用任何数量的语言,由任何数量的编译器版本创建,毕竟)。


(稍后添加):Turns out GCC has this feature in 4.3 if asked for when you compile the code :

A new command-line switch -frecord-gcc-switches ... causes the command line that was used to invoke the compiler to be recorded into the object file that is being created. The exact format of this recording is target and binary file format dependent, but it usually takes the form of a note section containing ASCII text.

关于c++ - 检测二进制文件的 GCC 编译时标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9989662/

相关文章:

c - 欧拉计划问题# 276 - 原始三角形

c - 在 Linux 中 "which source"什么都不返回?

c++ - 在 64 位 debian 上编译 GCC 的 CodeViz 补丁

C 解析带换行符的逗号分隔值

c++ - 简单的 getter/accessor 防止矢量化 - gcc 错误?

c - 我用 C 编写的库的最佳实践

c++ - ARM 平台上 C++ 应用程序中的 Pascal DLL

c++ - 在 C++ 应用程序中查找未引用的方法

c++ - 重新启动 linux 守护进程

C++ 可变参数模板 std::function 到 lambda 转换不起作用