gpt4 book ai didi

c - 有没有办法让 extconf.rb 不使用某些警告标志?

转载 作者:数据小太阳 更新时间:2023-10-29 08:10:29 26 4
gpt4 key购买 nike

我刚刚将 gcc 从默认的 4.2.1 更新到 4.5。但是当我运行 ruby​​ extconf.rb 时,我创建了一个 gcc 无法识别的警告标志。

cc1: error: unrecognized command line option "-Wshorten-64-to-32"

有没有办法编辑 extconf.rb 文件告诉它不要使用这个警告标志,或者有没有办法让 gcc 识别它?如果有帮助,这是我的 gcc 版本:

 $  gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin10/4.5.3/lto-wrapper
Target: x86_64-apple-darwin10
Configured with: ../gcc-4.5.3/configure --prefix=/opt/local --build=x86_64-apple-darwin10 --enable-languages=c,c++,objc,obj-c++,fortran,java --libdir=/opt/local/lib/gcc45 --includedir=/opt/local/include/gcc45 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.5 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.5 --with-gxx-include-dir=/opt/local/include/gcc45/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --enable-stage1-checking --disable-multilib --enable-fully-dynamic-string
Thread model: posix
gcc version 4.5.3 (GCC)

最佳答案

mkmf 使用 CONFIG 中定义的字符串表生成 makefile 配置,警告标志位于 CONFIG['warnflags'] 中,因此您可以执行类似

CONFIG['warnflags'].slice!(/ -Wshorten-64-to-32/)

create_makefile 被调用以去除特定警告标志之前。

关于c - 有没有办法让 extconf.rb 不使用某些警告标志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6478475/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com