gonewithwind 发表于 2010-5-20 02:04:50

ldd3 9章的例子 short.c编译通不过:

开始问题是:Fix it to use EXTRA_CFLAGS.Stop.
改了Makefile 的CFLAGS 为 EXTRA_CFLAGS后可以编译。
但又是config.h找不到 io.h找不到,又改为: 
#include <linux/configfs.h>
#include <linux/io.h>
再编译:
出错:In function ‘short_selfprobe’:
/home/emachines/bbt/driver/examples/short/short.c:516: error: ‘SA_INTERRUPT’ undeclared (first use in this function)
/home/emachines/bbt/driver/examples/short/short.c:516: error: (Each undeclared identifier is reported only once
/home/emachines/bbt/driver/examples/short/short.c:516: error: for each function it appears in.)
/home/emachines/bbt/driver/examples/short/short.c:516: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
include/linux/interrupt.h:116: note: expected ‘irq_handler_t’ but argument is of type ‘enum irqreturn_t (*)(int,void *, struct pt_regs *)’
/home/emachines/bbt/driver/examples/short/short.c:599:64: error: macro "INIT_WORK" passed 3 arguments, but takes just 2
/home/emachines/bbt/driver/examples/short/short.c: In function ‘short_init’:
/home/emachines/bbt/driver/examples/short/short.c:599: error: ‘INIT_WORK’ undeclared (first use in this function)
/home/emachines/bbt/driver/examples/short/short.c:626: error: ‘SA_SHIRQ’ undeclared (first use in this function)
/home/emachines/bbt/driver/examples/short/short.c:626: error: ‘SA_INTERRUPT’ undeclared (first use in this function)
/home/emachines/bbt/driver/examples/short/short.c:627: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
include/linux/interrupt.h:116: note: expected ‘irq_handler_t’ but argument is of type ‘enum irqreturn_t (*)(int,void *, struct pt_regs *)’
/home/emachines/bbt/driver/examples/short/short.c:640: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
include/linux/interrupt.h:116: note: expected ‘irq_handler_t’ but argument is of type ‘enum irqreturn_t (*)(int,void *, struct pt_regs *)’
/home/emachines/bbt/driver/examples/short/short.c:660: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
include/linux/interrupt.h:116: note: expected ‘irq_handler_t’ but argument is of type ‘enum irqreturn_t (*)(int,void *, struct pt_regs *)’
make: *** Error 1
make: *** Error 2
make: Leaving directory `/usr/src/linux-headers-2.6.31-14-generic'
make: *** Error 2



----------
这下许多macro找不到 也grep不到,不知怎么改了。用的ubuntu /usr/src/linux-headers-2.6.31-14-generic


谁做过?怎么办?

JCheung 发表于 2010-8-30 12:21:17

gcc 加参数。。。。。。。。。。
不过首先的是,你确定你机子上有kernel到源代码了?
页: [1]
查看完整版本: ldd3 9章的例子 short.c编译通不过: