c++ - 在 premake 3.7 中,如何为 gcc 生成 -O0 而不是 -O2?

标签 c++ gcc premake

似乎总是生成 -O2,除非我在 buildflags 中指定“optimize-speed”(生成 -O3)或“optimize-size”(生成 -Os)。如果我在 buildflags 中未指定任何内容,但将“-O0”传递给 buildoptions,则结果为“-O2 -O0”。然而,预期的结果只是“-O0”。

当我将“-O0”作为自定义构建选项传递时,如何防止生成“-O2”?该文档未提及任何相关内容。

最佳答案

可能有一种方法可以关闭 -02,但这不是必需的。

来自 GCC 手册页:

If you use multiple -O options, with or without level numbers, the last such option is the one that is effective.

关于c++ - 在 premake 3.7 中,如何为 gcc 生成 -O0 而不是 -O2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8989042/

相关文章:

linux - Fedora 下 Firefox 未加载 XPCOM 组件

opengl - 使用 premake4 构建项目文件 - 如何?

c++ - premake5 : how to set runtime library to Multithreaded DLL (/MD) in vs2015

c++ - 在 Premake 中指定文件类型

c++ - 通过宏检查错误

c++ - 代码在 Visual Studio 2010 中编译但根本不应该编译

c++ - SQL Server 从扩展存储过程捕获错误

c++ - 使用模板确定 std::array 大小 CRTP

c - 引用 C 中不带前导下划线的外部符号

c - GCC源代码目录(.c文件)