当前位置: 技术问答>linux和unix
求助:arm-linux交叉编译c程序出现的几个错误
来源: 互联网 发布时间:2016-02-03
本文导语: 命令:arm-linux-gcc -DMODULE -D__KERNEL__ -I/opt/ruiva/src/linux-2.4.21/include -o mypadmodule.o -c mykeypad.c 1:代码:static int key_read(struct file * filp, char * buf, int count, loff_t * l) 错误:error: parse error before "loff_t" 2:error: `EAGA...
命令:arm-linux-gcc -DMODULE -D__KERNEL__ -I/opt/ruiva/src/linux-2.4.21/include -o mypadmodule.o -c mykeypad.c
1:代码:static int key_read(struct file * filp, char * buf, int count, loff_t * l)
错误:error: parse error before "loff_t"
2:error: `EAGAIN' undeclared (first use in this function)
EAGAIN明明定义在asm-arm中的erron.h中,在命令行中指定的include中, 为什么找不到呢??
3:代码:static struct file_operations key_fops =
{
owner: THIS_MODULE,
poll: key_select,
read: key_read,
/*open: key_open,
release: key_close, */
};
错误:error: variable `key_fops' has initializer but incomplete type
error: unknown field `poll' specified in initializer
error: unknown field `read' specified in initializer
而在include/linux/fs.h中明明有
struct file_operations {
struct module *owner;
loff_t (*llseek) (struct file *, loff_t, int);
ssize_t (*read) (struct file *, char *, size_t, loff_t *);
ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
int (*readdir) (struct file *, void *, filldir_t);
unsigned int (*poll) (struct file *, struct poll_table_struct *);
int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
int (*mmap) (struct file *, struct vm_area_struct *);
int (*open) (struct inode *, struct file *);
........
4:代码:static devfs_handle_t devfs_handle;
错误: error: parse error before "devfs_handle"
帮帮忙吧,不胜感激!
1:代码:static int key_read(struct file * filp, char * buf, int count, loff_t * l)
错误:error: parse error before "loff_t"
2:error: `EAGAIN' undeclared (first use in this function)
EAGAIN明明定义在asm-arm中的erron.h中,在命令行中指定的include中, 为什么找不到呢??
3:代码:static struct file_operations key_fops =
{
owner: THIS_MODULE,
poll: key_select,
read: key_read,
/*open: key_open,
release: key_close, */
};
错误:error: variable `key_fops' has initializer but incomplete type
error: unknown field `poll' specified in initializer
error: unknown field `read' specified in initializer
而在include/linux/fs.h中明明有
struct file_operations {
struct module *owner;
loff_t (*llseek) (struct file *, loff_t, int);
ssize_t (*read) (struct file *, char *, size_t, loff_t *);
ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
int (*readdir) (struct file *, void *, filldir_t);
unsigned int (*poll) (struct file *, struct poll_table_struct *);
int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
int (*mmap) (struct file *, struct vm_area_struct *);
int (*open) (struct inode *, struct file *);
........
4:代码:static devfs_handle_t devfs_handle;
错误: error: parse error before "devfs_handle"
帮帮忙吧,不胜感激!
|
你把相应有错误的地方注释掉,先看能不能编译过去,然后再一个个解决。
|
你这个是serch path的问题,你可以具体指定文件-include 试一试,也可以把/opt/ruiva/src/linux-2.4.21/include 加到PATH路径中试一试。