编译错误:errno undeclared的解决
eclipsefunctionlinux
今天用eclipse编译arm linux驱动时,一直报错
'errno' undeclared (first use in this function)
在网上查了N久,才发现头文件包含错了,
以前是#include<asm/errno.h>
改为:#include<errno.h>
即可。------------------------------------------
errno.h中定义的常量undeclared (first use in this function)
分类: Linux学习 2011-12-03 20:15 1319人阅读 评论(0) 收藏 举报
functionlinuxeachx86
这几天用源代码方式安装程序是老是出现undeclared (first use in this function)的错误,例如下面的这个编译源文件错误error.h
Created Saturday 03 December 2011
SOURCE=1 -o objects/fileio.o fileio.c
fileio.c: In function ‘readfile’:
fileio.c:1560:40: error: ‘EINVAL’ undeclared (first use in this function)
fileio.c:1560:40: note: each undeclared identifier is reported only once for each function it appears in
fileio.c: In function ‘buf_write_bytes’:
fileio.c:5681:36: error: ‘EINVAL’ undeclared (first use in this function)
make[1]: *** [objects/fileio.o] Error 1
make[1]: Leaving directory `/home/hyf/Downloads/vim7/src'
make: *** [first] Error 2后来发现是编译源码的时候要用到这个文件但是里面却是什么也没有,可能是之前在编译x86的时候删了记得之前是#include <asm/errno.h>
/usr/include/linux/errno.h
之前是
#ifndef _LINUX_ERRNO_H
#define _LINUX_ERRNO_H#include <errno.h>
#endif
但是我的目录结构里面没有asm只有asm-generic,现在是:
#ifndef _LINUX_ERRNO_H
#define _LINUX_ERRNO_H#include <asm-generic/errno.h>
#endif