打印

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

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[2]: *** [/home/emachines/bbt/driver/examples/short/short.o] Error 1
make[1]: *** [_module_/home/emachines/bbt/driver/examples/short] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.31-14-generic'
make: *** [default] Error 2



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


谁做过?怎么办?

TOP

gcc 加参数。。。。。。。。。。
不过首先的是,你确定你机子上有kernel到源代码了?

TOP