Linux Device Driver学习平台问题
时间:2010-08-20
来源:互联网
帮个忙看一下这是些什么错误呀,我是初学者,解决不了:
jinjun8505@ubuntu:~$ vi tester.c
jinjun8505@ubuntu:~$ gcc -O2 -DMODULE -D__KERNEL__ -c tester.c
tester.c:1:2: error: invalid preprocessing directive #define_NO_VERSON_
tester.c:2:26: error: linux/modules.h: 没有那个文件或目录
tester.c:5: error: ‘UTS_RELEASE’ undeclared here (not in a function)
tester.c:8: error: expected declaration specifiers or ‘...’ before ‘off_t’
tester.c:8: warning: ‘struct file’ declared inside parameter list
tester.c:8: warning: its scope is only this definition or declaration, which is probably not what you want
tester.c:8: warning: ‘struct inode’ declared inside parameter list
tester.c:9: warning: ‘struct file’ declared inside parameter list
tester.c:9: warning: ‘struct inode’ declared inside parameter list
tester.c:10: error: expected declaration specifiers or ‘...’ before ‘off_t’
tester.c:10: warning: ‘struct file’ declared inside parameter list
tester.c:10: warning: ‘struct inode’ declared inside parameter list
tester.c:11: warning: ‘struct direct’ declared inside parameter list
tester.c:11: warning: ‘struct file’ declared inside parameter list
tester.c:11: warning: ‘struct inode’ declared inside parameter list
tester.c:12: error: expected declaration specifiers or ‘...’ before ‘select_table’
tester.c:12: warning: ‘struct file’ declared inside parameter list
tester.c:12: warning: ‘struct inode’ declared inside parameter list
tester.c:13: warning: ‘struct file’ declared inside parameter list
tester.c:13: warning: ‘struct inode’ declared inside parameter list
tester.c:14: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
tester.c:15: error: expected ‘;’ before ‘int’
In file included from /usr/include/asm-generic/types.h:7,
from /usr/include/asm/types.h:6,
from /usr/include/linux/types.h:4,
from tester.c:23:
/usr/include/asm-generic/int-ll64.h:19: error: two or more data types in declaration specifiers
/usr/include/asm-generic/int-ll64.h:19: error: two or more data types in declaration specifiers
tester.c:25:21: error: linux/mm.h: 没有那个文件或目录
tester.c:27:24: error: asm/segment.h: 没有那个文件或目录
tester.c:30: warning: ‘struct file’ declared inside parameter list
tester.c:30: warning: ‘struct inode’ declared inside parameter list
tester.c: In function ‘read_test’:
tester.c:33: error: ‘VERIFY_WRITE’ undeclared (first use in this function)
tester.c:33: error: (Each undeclared identifier is reported only once
tester.c:33: error: for each function it appears in.)
tester.c: At top level:
tester.c:42: warning: ‘struct file’ declared inside parameter list
tester.c:42: warning: ‘struct inode’ declared inside parameter list
tester.c:47: warning: ‘struct file’ declared inside parameter list
tester.c:47: warning: ‘struct inode’ declared inside parameter list
tester.c: In function ‘open_tibet’:
tester.c:49: error: ‘MOD_INC_USE_COUNT’ undeclared (first use in this function)
tester.c: At top level:
tester.c:53: warning: ‘struct file’ declared inside parameter list
tester.c:53: warning: ‘struct inode’ declared inside parameter list
tester.c: In function ‘release_tibet’:
tester.c:55: error: ‘MOD_DEC_USE_COUNT’ undeclared (first use in this function)
tester.c: At top level:
tester.c:58: error: variable ‘test_fops’ has initializer but incomplete type
tester.c:59: warning: excess elements in struct initializer
tester.c:59: warning: (near initialization for ‘test_fops’)
tester.c:60: warning: excess elements in struct initializer
tester.c:60: warning: (near initialization for ‘test_fops’)
tester.c:61: error: ‘write_test’ undeclared here (not in a function)
tester.c:61: warning: excess elements in struct initializer
tester.c:61: warning: (near initialization for ‘test_fops’)
tester.c:62: warning: excess elements in struct initializer
tester.c:62: warning: (near initialization for ‘test_fops’)
tester.c:63: warning: excess elements in struct initializer
tester.c:63: warning: (near initialization for ‘test_fops’)
tester.c:64: warning: excess elements in struct initializer
tester.c:64: warning: (near initialization for ‘test_fops’)
tester.c:65: warning: excess elements in struct initializer
tester.c:65: warning: (near initialization for ‘test_fops’)
tester.c:66: error: ‘open_test’ undeclared here (not in a function)
tester.c:66: warning: excess elements in struct initializer
tester.c:66: warning: (near initialization for ‘test_fops’)
tester.c:67: error: ‘release_test’ undeclared here (not in a function)
tester.c:67: warning: excess elements in struct initializer
tester.c:67: warning: (near initialization for ‘test_fops’)
tester.c:67: warning: excess elements in struct initializer
tester.c:67: warning: (near initialization for ‘test_fops’)
tester.c:68: warning: excess elements in struct initializer
tester.c:68: warning: (near initialization for ‘test_fops’)
tester.c: In function ‘init_module’:
tester.c:78: error: ‘KERN_INFO’ undeclared (first use in this function)
tester.c:78: error: expected ‘)’ before string constant
jinjun8505@ubuntu:~$ vi tester.c
jinjun8505@ubuntu:~$ gcc -O2 -DMODULE -D__KERNEL__ -c tester.c
tester.c:1:2: error: invalid preprocessing directive #define_NO_VERSON_
tester.c:2:26: error: linux/modules.h: 没有那个文件或目录
tester.c:5: error: ‘UTS_RELEASE’ undeclared here (not in a function)
tester.c:8: error: expected declaration specifiers or ‘...’ before ‘off_t’
tester.c:8: warning: ‘struct file’ declared inside parameter list
tester.c:8: warning: its scope is only this definition or declaration, which is probably not what you want
tester.c:8: warning: ‘struct inode’ declared inside parameter list
tester.c:9: warning: ‘struct file’ declared inside parameter list
tester.c:9: warning: ‘struct inode’ declared inside parameter list
tester.c:10: error: expected declaration specifiers or ‘...’ before ‘off_t’
tester.c:10: warning: ‘struct file’ declared inside parameter list
tester.c:10: warning: ‘struct inode’ declared inside parameter list
tester.c:11: warning: ‘struct direct’ declared inside parameter list
tester.c:11: warning: ‘struct file’ declared inside parameter list
tester.c:11: warning: ‘struct inode’ declared inside parameter list
tester.c:12: error: expected declaration specifiers or ‘...’ before ‘select_table’
tester.c:12: warning: ‘struct file’ declared inside parameter list
tester.c:12: warning: ‘struct inode’ declared inside parameter list
tester.c:13: warning: ‘struct file’ declared inside parameter list
tester.c:13: warning: ‘struct inode’ declared inside parameter list
tester.c:14: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
tester.c:15: error: expected ‘;’ before ‘int’
In file included from /usr/include/asm-generic/types.h:7,
from /usr/include/asm/types.h:6,
from /usr/include/linux/types.h:4,
from tester.c:23:
/usr/include/asm-generic/int-ll64.h:19: error: two or more data types in declaration specifiers
/usr/include/asm-generic/int-ll64.h:19: error: two or more data types in declaration specifiers
tester.c:25:21: error: linux/mm.h: 没有那个文件或目录
tester.c:27:24: error: asm/segment.h: 没有那个文件或目录
tester.c:30: warning: ‘struct file’ declared inside parameter list
tester.c:30: warning: ‘struct inode’ declared inside parameter list
tester.c: In function ‘read_test’:
tester.c:33: error: ‘VERIFY_WRITE’ undeclared (first use in this function)
tester.c:33: error: (Each undeclared identifier is reported only once
tester.c:33: error: for each function it appears in.)
tester.c: At top level:
tester.c:42: warning: ‘struct file’ declared inside parameter list
tester.c:42: warning: ‘struct inode’ declared inside parameter list
tester.c:47: warning: ‘struct file’ declared inside parameter list
tester.c:47: warning: ‘struct inode’ declared inside parameter list
tester.c: In function ‘open_tibet’:
tester.c:49: error: ‘MOD_INC_USE_COUNT’ undeclared (first use in this function)
tester.c: At top level:
tester.c:53: warning: ‘struct file’ declared inside parameter list
tester.c:53: warning: ‘struct inode’ declared inside parameter list
tester.c: In function ‘release_tibet’:
tester.c:55: error: ‘MOD_DEC_USE_COUNT’ undeclared (first use in this function)
tester.c: At top level:
tester.c:58: error: variable ‘test_fops’ has initializer but incomplete type
tester.c:59: warning: excess elements in struct initializer
tester.c:59: warning: (near initialization for ‘test_fops’)
tester.c:60: warning: excess elements in struct initializer
tester.c:60: warning: (near initialization for ‘test_fops’)
tester.c:61: error: ‘write_test’ undeclared here (not in a function)
tester.c:61: warning: excess elements in struct initializer
tester.c:61: warning: (near initialization for ‘test_fops’)
tester.c:62: warning: excess elements in struct initializer
tester.c:62: warning: (near initialization for ‘test_fops’)
tester.c:63: warning: excess elements in struct initializer
tester.c:63: warning: (near initialization for ‘test_fops’)
tester.c:64: warning: excess elements in struct initializer
tester.c:64: warning: (near initialization for ‘test_fops’)
tester.c:65: warning: excess elements in struct initializer
tester.c:65: warning: (near initialization for ‘test_fops’)
tester.c:66: error: ‘open_test’ undeclared here (not in a function)
tester.c:66: warning: excess elements in struct initializer
tester.c:66: warning: (near initialization for ‘test_fops’)
tester.c:67: error: ‘release_test’ undeclared here (not in a function)
tester.c:67: warning: excess elements in struct initializer
tester.c:67: warning: (near initialization for ‘test_fops’)
tester.c:67: warning: excess elements in struct initializer
tester.c:67: warning: (near initialization for ‘test_fops’)
tester.c:68: warning: excess elements in struct initializer
tester.c:68: warning: (near initialization for ‘test_fops’)
tester.c: In function ‘init_module’:
tester.c:78: error: ‘KERN_INFO’ undeclared (first use in this function)
tester.c:78: error: expected ‘)’ before string constant
作者: jinjun8505 发布时间: 2010-08-20
你是跟谁学的这编译方法,扁他。 
内核模块不是这样编译的,好歹你也要带上内核路径把,不然它去哪里找头文件啊。

内核模块不是这样编译的,好歹你也要带上内核路径把,不然它去哪里找头文件啊。
作者: linjiework 发布时间: 2010-08-20
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28