GCC编译警告和错误

常见gcc 编译错误整理(开始) 1

1 error: expected expression before 'else'

else之前无表达式。



2 error: lvalue required as left operand of assignment

左值问题。



3 error: invalid storage class for function 'XXXXXX'

在文件的某个地方,丢失了一个大括号}’





常见gcc编译警告整理(开始)

1warning: no newline at end of file

在文件最后一行加上回车键

解释:在《Rationale for the C99 standard》一文中,有C99的相关信息:
A backslash immediately before a newline has long been used to continue string literals, as well as preprocessing command lines. In the interest of easing machine generation of C, and of transporting code to machines with restrictive physical line lengths, the C89 Committee generalized this mechanism to permit any token to be continued by interposing a backslash/newline sequence.
c/c++
代码的每一行后面有一个结束符,也就是newline。避免当被include的文件展开后,前一个文件的最后一行与后一个文件的第一行直接被连接成一行从而造成错误。

2warning: comparison between pointer and integer

解释:integerpointer比较

3、 warning: assignment discards qualifiers from pointer target type

解释:赋值时,取消了右值的限定。

4、 warning: passing argument 1 of 'send' makes pointer from integer without a cast

解释:函数send的第一个integer型参数没有强制转换为pointer

5warning: comparison is always true due to limited range of data type

解释:由于数据类型范围的限制,比较结果一直为真。

6warning: initialization from incompatible pointer type

解释:不兼容指针类型的初始化

7、 warning: return makes pointer from integer without a cast

解释:return使integer转换为pointer,没有加强制类型转换。

8warning: incompatible implicit declaration of built-in function 'printf'

解释:与内置的printf函数隐士声明不兼容。

9warning: initialization discards qualifiers from pointer target type

解释:initialization取消了指针目标类型的限定。


10warning: comparison is always false due to limited range of data type

由于类型限制,比较一直是假



11warning: assignment from incompatible pointer type

不兼容的指针间赋值


12warning: passing argument 1 of 'mes_read_time' discards qualifiers from pointer target type12

mes_函数第一个参数的传递,丢弃了指针目标类型限定。

13warning: "protocol_type" redefined

——type重定义


14warning: 'return' with a value, in function returning void

void返回类型的函数中,return返回值。


转载于:https://www.cnblogs.com/johnnyflute/p/3595699.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值