errno.h中定义的常量undeclared (first use in this function)
2011-12-03 20:15
344 查看
这几天用源代码方式安装程序是老是出现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
编译源文件错误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
相关文章推荐
- C编译时`true' undeclared (first use in this function)
- Centos安装fabric 报错:error: ‘FFI_DEFAULT_ABI’ undeclared (first use in this function)
- mainarg.c:7:20: error: ‘argc’ undeclared (first use in this function)
- 问题解决: error: ‘SCM_CREDENTIALS’ undeclared (first use in this function)
- 'O_BINARY' undeclared (first use in this function)
- error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
- NF_IP_PRE_ROUTING’ undeclared (first use in this function)
- MySQL 编译出现 error: 'SSL_OP_NO_COMPRESSION' undeclared (first use in this function) 错误
- error: ‘PATH_MAX’ undeclared (first use in this function)
- error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
- [kernel]: error: ‘PATH_MAX’ undeclared (first use in this function)
- error: 'ENOSYS' undeclared (first use in this function)
- 编译minicom出现问题:error: ‘BC’ undeclared (first use in this function)
- check_http.c:312: error: ‘ssl_version’ undeclared (first use in this function)
- error: 'FALSE' undeclared (first use in this function)
- qemu-2.4.0编译时出错:error: ‘XFS_IOC_ZERO_RANGE’ undeclared (first use in this function)
- `pid_t' undeclared (first use in this function)
- error: 'FILE' undeclared (first use in this function)
- C编译时`true' undeclared (first use in this function)