【发布时间】:2013-03-13 20:44:19
【问题描述】:
我在 Linux 上使用 gcc 4.1.2,遇到以下警告:
warning: type qualifiers ignored on function return type
我尝试使用“-Wno-ignored-qualifiers”来消除此警告,但似乎不支持:
cc1: error: unrecognized command line option "-Wno-ignored-qualifiers"
有没有办法在 gcc 4.1.2 中禁用此类警告?
非常感谢。
【问题讨论】:
-
什么代码/行导致了这个警告?
-
函数返回“const char *”
-
first google search result for the warning(不要离开这里...)
-
@user1783732:如果它返回一个
const char *,那么它不应该引起这个警告,因为该限定符是有意义的并且不会被忽略。你一定有别的东西。为什么不显示导致警告的实际代码?可能是您实际上有一个char * const,而您的真正意思是const char *,但您对宏或 typedef 感到困惑,这就是警告警告您的原因