一、

001.c: 在函数 ‘main’ 中:

001.c:8: 错误:‘start’ 的存储大小未知

001.c:9: 错误:‘end’ 的存储大小未知

=========================

#include <arpa/inet.h>

#include <netinet/in.h>









这两个头文件可以把错误与警告消除

#include <arpa/inet.h>

#include <netinet/in.h> 





编译时起码把下面的选项加上,没有坏处

gcc -g -O2 -Wall

http://blog.csdn.net/susubuhui/article/details/8272397

=====================================================================================================

二、

menu.c:1184: warning: braces around scalar initializer

menu.c:1184: warning: (near initialization for 'list0[120]')

menu.c:1184: warning: excess elements in scalar initializer

menu.c:1184: warning: (near initialization for 'list0[120]')

===============

今天编译程序的时候也 出现这样的错误, 最后发现是 .h文件中 乱入 几个字符,改正后编译OK!

三、

menu.c:1366: warning: excess elements in array initializer

menu.c:1366: warning: (near initialization for 'list0')

menu.c:1375: warning: excess elements in array initializer

menu.c:1375: warning: (near initialization for 'list0')

===============

list0[]  下标 个数 不匹配,

=========================2014年10月20日星期一  16:02:30==========================

四、warning: pointer targets in passing argument 1 of 'Sound6188' differ in signedness

原因分析:

指针所指的符号不一致,在GCC里,unsigned char *,signed char *和char *是不同的类型,如果相互赋值会有警告

void LCD_write_str(uchar X,uchar Y,uchar *s);第三个参数类型是unsigned char *

而:LCD_write_str(0,0,"abcdefg");第三个参数"abcdefg"类型是char *,

把char *转递给unsigned char *,发生了数据类型不匹配的问题,因此产生了警告。

=========================2014年12月22日星期一  14:02:30==========================

五、incompatible types in assignment  参数类型不兼容

原因分析:   跨文件 函数 使用 未声明, 加上  #include "PublicFunction.h" 即可

=========================2015年2月10日星期二  17:02:30==========================

六、

[root@localhost Download]# ./QIpmsg 

./QIpmsg: /lib/libc.so.6: version `GLIBC_2.9' not found (required by ./QIpmsg)

./QIpmsg: /lib/libc.so.6: version `GLIBC_2.15' not found (required by ./QIpmsg)

./QIpmsg: /lib/libc.so.6: version `GLIBC_2.10' not found (required by ./QIpmsg)

./QIpmsg: /lib/libc.so.6: version `GLIBC_2.11' not found (required by ./QIpmsg)

./QIpmsg: /lib/libc.so.6: version `GLIBC_2.7' not found (required by ./QIpmsg)

[root@localhost Download]#

[root@localhost Download]# rpm -qi glibc

Name        : glibc                        Relocations: (not relocatable)

Version     : 2.6                               Vendor: Koji

Release     : 3                             Build Date: 2007年05月24日 星期四 19时23分26秒

Install Date: 2014年03月07日 星期五 09时27分40秒      Build Host: xenbuilder2.fedora.redhat.com

Group       : System Environment/Libraries   Source RPM: glibc-2.6-3.src.rpm

Size        : 12868833                         License: LGPL

Signature   : DSA/SHA1, 2007年05月25日 星期五 02时29分03秒, Key ID b44269d04f2a6fd2

Packager    : Koji

Summary     : GNU libc 库。

Description :

glibc 软件包包括在系统上被多个程序使用的标准库。

为了要节省磁盘空间和内存,以及简化升级进程,

公用的系统编码被保留在一处,在程序间共享。这个

软件包包括几组最重要的共享库:标准的 C 库和标准

的数学库。没有这两个库,Linux 系统将无法操作。

 

 

[root@localhost Download]# yum -y update glibc

Loading "installonlyn" plugin

Setting up Update Process

原因分析: glibc 版本过低;

========================= 2015年3月20日星期五  17:05:00 ==========================

七、 implicit declaration of function

原因分析:  在函数所在的c文件中定义了,但是没有在与之相关联的.h文件中声明

解决方案:

1、添加 .h 文件;

2、extern 该函数;

八、warning:ISO C90 forbids mixed declarations and code

原因分析:

变量定义之前任何一条非变量定义的语句(重视:语句是会带分号的)都会引起这个警告! 将非变量的定义移到变量定义之后 即可,也就是变量的声明 必须在执行语句之前。

========================= 2015年3月30日星期一, 10:00:09 ==========================

八、找不到 动态库/静态库文件

# ./Dvr 

./Dvr: can't load library 'libmpi.so'

原因分析:  所需要的库文件未加载

解决方案:

1、将所需要的库文件添加到 /usr/lib 下;

2、编辑 /etc/profile,添加所需要的库文件路径

LD_LIBRARY_PATH="/sdcard/mpp/lib_hi3520A:/usr/local/lib:/usr/lib";

========================= 2015年4月8日星期三 17:49:08 ==========================

九、找不到 动态库/静态库文件

#  warning: implicit declaration of function

原因分析:  该函数的文件头文件( .h) 未在出错文件中添加

解决方案:

添加所缺的.h 头文件即可;

========================= ========================= 2015年4月9日星期四 17:55:17  ==========================

十、内存泄漏

#  MMB LEAK(pid=894): 0x8A613000, 249856 bytes, ''mmz_userdev_release: mmb<0x8A613000> mapped to userspace 0x4054f000 will be force unmaped!

Segmentation fault

原因分析:  非法访问内存

解决方案:

1、添加打印信息,定位出错位置;

2、出错位置是 创建线程函数,检查 传参,发现参数仅 定义,未 malloc 分配内存;

3、分配内存 + 在调用函数中free相应的内存,debug OK!

十一、incompatible implicit declaration

#  warning: incompatible implicit declaration of built-in function 'exit'

原因分析:  缺少相应的头文件

解决方案:

1、添加#include <stdlib.h> 即可

十二、 符号优先级

# warning:suggest parentheses around '+' inside '<<'

原因分析:  符号优先级

解决方案:

1、将 << 表达式 添加 () 即可;

十二、 找不到 库文件

#  ....  cannot find -lqte

原因分析:  查看打印信息,发现库文件的 路径指定错误

解决方案:

1、检查 /etc/profile  文件, 修正环境变量即可

================================================== 2015年4月13日星期一, 09:32:07  ==========================

十三、二次确认 " = "

#  warning: suggest parentheses around assignment used as truth value

原因分析:  if (atype=search(alphatp,1))

在C语言中 非0代表TRUE ,反之为FALSE。 atype值是用于最后的判断用的,但是由于长期的编程实践告诉我们, 人们经常在“=”和“==”的使用上出现手误,所以gcc编译器为此要求我们明确地告诉编译器它“=”而不是“==”

解决方案:

1、添加一对 () 即可

if ((
atype=search(alphatp,1) ))

十四、static 关键字

#  warning 'XXX' declared 'static' but never defined

原因分析:  static 关键字 表明该函数OR变量仅仅在当前文件内使用

解决方案:

1、函数OR变量仅仅在  .c  文件中声明,因为在.h中声明时,其他文件引用该.h时候会包含该函数;

十五、warning: unused parameter

#  warning: unused parameter

原因分析:  参数声明但未使用

解决方案:

1、void fun(int a)

{

a = a;

}

2、



                #ifdef UNUSED

                #elif defined(__GNUC__)

                # define UNUSED(x) UNUSED_ ## x __attribute__((unused))

                #elif defined(__LCLINT__)

                # define UNUSED(x) /*@unused@*/ x

                #else

                # define UNUSED(x) x

                #endif





                void dcc_mon_siginfo_handler(int UNUSED(whatsig))

十五、expected specifier-qualifier-list

#  error: expected specifier-qualifier-list before ‘u8’

原因分析:   自定义的类别 未找到定义

解决方案:

1、u8   --->  unsigned char  , 改为 系统定义的类型名即可;

==================================================  2015年4月14日星期二  13:34:45  ==========================

十六、结构体成员变量为完全初始化

#  warning: missing initializer

    warning: (near initialization for 'DEV_ATTR_BT656D1_4MUX.enDataSeq')

原因分析:  结构体成员变量在初始化赋值的过程中,仅仅对部分变量赋值

解决方案:

1、严格按照结构体定义对每一项成员变量进行赋值, 包括数组成员变量的{}也需要一致;

最新文章

  1. Swing——JFrame
  2. 圆角button
  3. MFC中消息响应机制
  4. What is martian source / martian packets
  5. 【设计模式 - 4】之原型模式(Prototype)
  6. POJ 1417 True Liars
  7. 提前防止Non-PIE错误,检测app是否包含PIE标志
  8. strncasecmp与strcasecmp用法
  9. Mac端SVN工具CornerStone详解
  10. java内存区域——深入理解JVM读书笔记
  11. 学习爬虫的day02 (用线程去爬虫 提高速度)
  12. python源文件转换成exe问题解决贴
  13. BZOJ 1119: [POI2009]SLO [置换群]
  14. jQuery.extend 与 jQuery.fn.extend
  15. vi/vim 文字处理器常用命令
  16. spring boot 分布式事务实现(XA方式)
  17. 使用jstl方式替换服务器请求地址
  18. [LeetCode] 532. K-diff Pairs in an Array_Easy tag: Hash Table
  19. maven学习(6)-Maven依赖范围
  20. oracle表属性

热门文章

  1. la3211
  2. WCF 通讯标准绑定
  3. Django day25 序列化组件(*****)
  4. RocketMQ(2)
  5. 点击文字弹出一个DIV层窗口代码 【或FORM表单 并且获取点击按钮的ID值】
  6. 342 Power of Four 4的幂
  7. java中使用String的replace方法替换html模板保存文件
  8. 移动web——bootstrap媒体对象
  9. [Windows Server 2003] 安装PHP+MySQL方法
  10. [Windows Server 2008] IIS自带FTP配置方法