我写了一个模块,已经编译通过,运行没有问题
可是我希望进一步再模块中使用Glib库的API的时候,加入
#include
编译模块的时候怎么样都找不到glib.h
我知道模块编译的时候是在系统空间编译的,
我在用户空间引用glib.h就没有问题,
那么怎么在系统空间编译模块的时候引用glib.h呢
我用的是2.6的内核
没有引用Glib时,成功编译内核用的命令是
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
我除了要因用glib.h外,还想引用DBus库,
请高手指点~~~
引用glib.h时,编译错误如下:
root@xiaoming-desktop:/home/work/code/drv7000ic# make modules
make -C /lib/modules/2.6.31-18-generic/build M=/home/work/code/drv7000ic modules
make[1]: 正在进入目录 `/usr/src/linux-headers-2.6.31-18-generic'
CC [M] /home/work/code/drv7000ic/drv7000ic.o
In file included from /home/work/code/drv7000ic/drv7000ic.c:11:
/home/work/code/drv7000ic/drv7000ic.h:33:18: error: glib.h: 没有该文件或目录
/home/work/code/drv7000ic/drv7000ic.h:34:23: error: dbus/dbus.h: 没有该文件或目录
/home/work/code/drv7000ic/drv7000ic.h:35:28: error: dbus/dbus-glib.h: 没有该文件或目录
In file included from /home/work/code/drv7000ic/drv7000ic.h:37,
from /home/work/code/drv7000ic/drv7000ic.c:11:
/home/work/code/drv7000ic/XxxDevMgrClient.h:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘static’
/home/work/code/drv7000ic/XxxDevMgrClient.h:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘com_neusoft_XxxDevMgrServ_xxx_device_status’
In file included from /home/work/code/drv7000ic/drv7000ic.h:37,
from /home/work/code/drv7000ic/drv7000ic.c:11:
/home/work/code/drv7000ic/XxxDevMgrClient.h:35: error: expected ‘)’ before ‘*’ token
/home/work/code/drv7000ic/XxxDevMgrClient.h:38: error: expected ‘)’ before ‘*’ token
/home/work/code/drv7000ic/XxxDevMgrClient.h:52: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
In file included from /home/work/code/drv7000ic/drv7000ic.c:11:
/home/work/code/drv7000ic/drv7000ic.h:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘static’
make[2]: *** [/home/work/code/drv7000ic/drv7000ic.o] 错误 1
make[1]: *** [_module_/home/work/code/drv7000ic] 错误 2
make[1]:正在离开目录 `/usr/src/linux-headers-2.6.31-18-generic'
make: *** [modules] 错误 2