分页: 1 / 1

Ubuntu下的模块编程

发表于 : 2007-07-16 10:05
howema
写了 个简单的模块程序,想在ubuntu6.10下看下运行结果,编译后总是提示没有头文件,不知道什么问题,在ubuntu下写模块程序还需要什么具体的操作呢?高手赐教。安装后的ubuntu的源代码在哪里可以找到阿?

发表于 : 2007-07-16 10:20
howema
以下是错误提示:

dr.c:1:27: error: linux/module.h: No such file or directory
dr.c:3:27: error: linux/config.h: No such file or directory
dr.c:5:25: error: linux/init.h: No such file or directory
dr.c:7: error: expected declaration specifiers or ‘...’ before string constant
dr.c:7: warning: data definition has no type or storage class
dr.c: In function ‘hello_init’:
dr.c:13: error: ‘KERN_ALERT’ undeclared (first use in this function)
dr.c:13: error: (Each undeclared identifier is reported only once
dr.c:13: error: for each function it appears in.)
dr.c:13: error: expected ‘)’ before string constant
dr.c: In function ‘hello_exit’:
dr.c:23: error: ‘KERN_ALERT’ undeclared (first use in this function)
dr.c:23: error: expected ‘)’ before string constant
dr.c: At top level:
dr.c:27: warning: data definition has no type or storage class
dr.c:27: warning: parameter names (without types) in function declaration
dr.c:29: warning: data definition has no type or storage class
dr.c:29: warning: parameter names (without types) in function declaration

发表于 : 2007-07-22 17:24
stlxv
内核头文件要装

发表于 : 2007-07-26 9:36
howema
如何安装阿?
我的内核目录下找不到build那个文件。

发表于 : 2007-07-29 9:03
smartyin
howema 写了:如何安装阿?
我的内核目录下找不到build那个文件。
linux-headers,其实module编程的依赖库是最少的,毕竟内核启动的时候可没什么给你依赖的,哈哈

发表于 : 2008-05-26 20:55
sharpshootor
怎么没说如何装啊,晕
如何是我没看懂
apt-get install linux-source
:oops:

发表于 : 2008-05-26 21:03
BigSnake.NET
aptitude install linux-headers-`uname -r`