Chinaunix首页 | 论坛 | 博客
  • 博客访问: 374719
  • 博文数量: 124
  • 博客积分: 2911
  • 博客等级: 少校
  • 技术积分: 1050
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-15 15:57
文章分类

全部博文(124)

文章存档

2012年(6)

2011年(26)

2010年(92)

我的朋友

分类: LINUX

2012-02-28 21:09:50

Q: undefined symbol
A: 有两个可能原因:
1) 程序中引用了未定义的函数或者全局变量。
2) 程序中调用了某个库函数,但在链接时没有对相应的函数库进行链接。这中情况请参见“Gcc使用方法”。

Q: II ( b, c, d, a, in[ 9], S44, 3951481745); /* 64 */ 
warning: "this decimal constant is unsigned only in ISO C90" 
A: c语言里面的常量默认是一个32位的有符号整型数。对于3951481745,由于无法用32位的有符号整型数表示,所以会报警告。解决方法是改成这样:
II ( b, c, d, a, in[ 9], S44, 3951481745UL); /* 64 */


Q: expected specifier-qualifier-list before "UWORD32"
A: 增加类型声明: e.g.:#define UWORD32 unsigned long

Q: The module has an invalid magic number
A: Due to the binary is compiled as 32 bit and the used in the 64 bit runtime.

Q: 0711-317 ERROR: Undefined symbol: xxxx
A: 如果声明过了依旧出现,说明在整个程序中没有相关定义

Q: dereferencing pointer to incomplete type
A: 指针,有一个类型,这个类型是不完全的。也就是说,你只给出了这个类型的声明,没有给出其定义。你这里的类型多半是结构,联合之类的东西。

Q: function declaration isn't a prototype
A: static void cut_mode(void),如果写成static void cut_mode(),就会有警告function declaration isn't a prototype.

Q: warning: dereferencing type-punned pointer will break strict-aliasing rules
A:
gcc3以后引入了strict aliasing 架构,当编译时使用-fstrict-aliasing参数(该参数在使用-O2 , -O3, -Os 优化参数的情况下默认生效),而源代码中存在一些违反strict-aliasing规则的地方的话,编译器就会对这部分代码提出warning 。
规则:编译器希望不同类型的对象不会指向同一个地址。比如:
int retLen;
someSetFunc((unsigned long*)&retLen);
printf("ret len = %d\n",retLen);
效果:基本无害。
消灭方法:
1)在Makefile中删除 -fstrict-aliasing 和 -Wstrict-aliasing。或删除Werror ,或用 -Wno-strict-aliasing屏蔽warning信息(-.-!)。
2)更改代码,采用union的不同成员变量来完成类型转换。
阅读(1022) | 评论(0) | 转发(0) |
0

上一篇:AIX_CMD

下一篇:git_step

给主人留下些什么吧!~~