Chinaunix首页 | 论坛 | 博客
  • 博客访问: 531293
  • 博文数量: 87
  • 博客积分: 1549
  • 博客等级: 上尉
  • 技术积分: 970
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-14 16:56
文章分类
文章存档

2013年(10)

2012年(28)

2011年(49)

分类: LINUX

2011-03-27 18:53:59

用arm-linux-gcc 出现警告:warning: incompatible implicit declaration of built-in function strcpy 
虽是一个警告,但说是不相容,故上网查了一下看到:

In C, using a previously undeclared function constitutes an implicit declaration of the function. In an implicit declaration, the return type is int if I recall correctly. Now, GCC has built-in definitions for some standard functions. If an implicit declaration does not match the built-in definition, you get this warning.

To fix the problem, you have to declare the functions before using them; normally you do this by including the appropriate header. I recommend not to use the -fno-builtin-* flags if possible.

Instead of stdlib.h, you should try

#include  

That's where strcpy and strncpy are defined, at least according to the strcpy(2) man page.

The exit function is defined in stdlib.h, though, so I don't know what's going on there.

所以就在开头加了#include 解决问题
 
但是后来出现:-/sh:XXX:not found
两种可能:
一就是有可能/lib下面没有C库 就是没有glibc或者uclibc的动态库
二就是你板子上的C库和编译XXX链接时用的C库不一样, 差别太大
经查询知道缺少静态库,解决方法:1.把用到的库发到板子上
                                2.用静态编译 -static
用方法2解决问题
 
运行时出现:Segmentation fault
阅读(5773) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~