转:"-Werror "产生的教训

今天一问题小结:

多花了半天时间,得一教训.

案例:

在准备重新做squid-3.0.STABLE16squid-3.0.STABLE16配置 make 时出现以下错误使make中断

       g++ -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE=\"/usr/local/squid/etc/squid.conf\" -I. -I../include -I. -I.                -I../include -I../include -I../lib/libTrie/include    -Werror -Wall -Wpointer-arith -Wwrite-strings -Wcomments                 -g -O2 -MT client_side.o -MD -MP -MF $depbase.Tpo -c -o client_side.o client_side.cc &&\
        mv -f $depbase.Tpo $depbase.Po
cc1plus: warnings being treated as errors
client_side.cc: In function 'int connKeepReadingIncompleteRequest(RefCount<ConnStateData>&)':
client_side.cc:2144: error: comparison between signed and unsigned integer expressions
make[3]: *** [client_side.o] Error 1
make[3]: Leaving directory `/root/squid-3.0.STABLE16/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/root/squid-3.0.STABLE16/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/root/squid-3.0.STABLE16/src'
make: *** [all-recursive] Error 1

经过多次检查确实编译环境没有问题,依赖也没有问题,问题就出在"cc1plus: warnings being treated as errors" 上gcc里如果加上 -Werror 来严格检查编译环境使用它能够使gcc产生告警也认为是错误.   faint. 就在这里 .当时没有仔细看错误输出,想当然地认为环境有问题,于是多折腾了半天时间.

解决这个问题也很简单,其实错误输出时都已有提示:

1, 进入 ./src目录 , 备份Makefile

2, 编辑Makefile 用空格替换所有的"-Werror " 后保存退出.

重新make && make install 一路顺畅

转载于:https://www.cnblogs.com/suyanghao/archive/2011/11/25/2262489.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值