mah*_*ood 12 makefile configure
在使用Makefile创建项目时,我收到此错误:
error: implicit declaration of function ‘fatal’ [-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors
Run Code Online (Sandbox Code Playgroud)
./configure --help显示
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
--disable-gtktest do not try to compile and run a test GTK+ program
--enable-debug Turn on debugging
Run Code Online (Sandbox Code Playgroud)
怎么能告诉configure不要包含-Werror?
小智 18
Werror是一个gcc参数,你不能直接删除它./configure,否则--disable-error会出现在帮助文本中的选项.但是,这是可能的.
设置环境变量:
export CFLAGS="-Wno-error"
Run Code Online (Sandbox Code Playgroud)
这适用于C编译器.如果项目使用C++,请执行以下操作:
export CXXFLAGS="-Wno-error"
Run Code Online (Sandbox Code Playgroud)
在非常罕见的情况下,项目不会尊重这些变量,您最后的办法是编辑configure.ac文件并搜索-Werror并将其从发生的字符串中删除(但要小心).
似乎这个功能已经在autotools中使用了很多年:
./configure --disable-werror
Run Code Online (Sandbox Code Playgroud)
不幸的是,我无法得到以下具体案例:
./configure --enable-wno-error=unused-value
Run Code Online (Sandbox Code Playgroud)
也许它可以工作,如果一个逃脱' ='符号,假设它是可能的.就像脱脂说的那样,人们仍然可以使用CFLAGS或CXXFLAGS.