当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 4 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : [求助]编译hello world模块出错
帖子发表于 : 2008-09-25 23:54 

注册: 2008-06-29 13:04
帖子: 4
送出感谢: 0 次
接收感谢: 0 次
我用gcc编译一个最简单的hello, world!模块,出现一大堆错误,看内容好象是系统自带的头文件出错了,我该怎么办?
1 #include <linux/module.h>
2
3 #if defined(CONFIG_SMP)
4 #define __SMP__
5 #endif
6
7 #if defined(CONFIG_MODVERSIONS)
8 #define MODVERSIONS
9 #include <linux/modversions.h>
10 #endif
11
12 #include <linux/kernel.h>
13
14 static __init int init_module(void)
15 {
16 printk(KERN_DEBUG "Hello, kernel!\n");
17 return 0;
18 }
19
20 static __exit void cleanup_module(void)
21 {
22 printk(KERN_DEBUG "Good-bye, kernel!\n");
23 }


gcc -D__KERNEL__ -D__SMP__ -DMODULE -DMODVERSIONS -I /usr/src/linux-headers-2.6.24-16/include -Wall -O2 -c hello.c

In file included from /usr/src/linux-headers-2.6.24-16/include/linux/prefetch.h:13,
from /usr/src/linux-headers-2.6.24-16/include/linux/list.h:8,
from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:9,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/types.h:197: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘resource_size_t’
在包含自 /usr/src/linux-headers-2.6.24-16/include/linux/list.h:8 的文件中,
从 /usr/src/linux-headers-2.6.24-16/include/linux/module.h:9,
从 hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/prefetch.h:14:27: 错误: asm/processor.h:没有该文件或目录
/usr/src/linux-headers-2.6.24-16/include/linux/prefetch.h:15:23: 错误: asm/cache.h:没有该文件或目录
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/list.h:8,
from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:9,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/prefetch.h:53: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
在包含自 /usr/src/linux-headers-2.6.24-16/include/linux/module.h:9 的文件中,
从 hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/list.h:9:24: 错误: asm/system.h:没有该文件或目录
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:9,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/list.h: 在函数‘__list_add_rcu’中:
/usr/src/linux-headers-2.6.24-16/include/linux/list.h:100: 警告: 隐式声明函数‘smp_wmb’
在包含自 /usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:11 的文件中,
从 /usr/src/linux-headers-2.6.24-16/include/linux/cache.h:4,
从 /usr/src/linux-headers-2.6.24-16/include/linux/time.h:7,
从 /usr/src/linux-headers-2.6.24-16/include/linux/stat.h:60,
从 /usr/src/linux-headers-2.6.24-16/include/linux/module.h:10,
从 hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/linkage.h:4:25: 错误: asm/linkage.h:没有该文件或目录
在包含自 /usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:15 的文件中,
从 /usr/src/linux-headers-2.6.24-16/include/linux/cache.h:4,
从 /usr/src/linux-headers-2.6.24-16/include/linux/time.h:7,
从 /usr/src/linux-headers-2.6.24-16/include/linux/stat.h:60,
从 /usr/src/linux-headers-2.6.24-16/include/linux/module.h:10,
从 hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/bitops.h:17:24: 错误: asm/bitops.h:没有该文件或目录
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:15,
from /usr/src/linux-headers-2.6.24-16/include/linux/cache.h:4,
from /usr/src/linux-headers-2.6.24-16/include/linux/time.h:7,
from /usr/src/linux-headers-2.6.24-16/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:10,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/bitops.h: 在函数‘get_bitmask_order’中:
/usr/src/linux-headers-2.6.24-16/include/linux/bitops.h:29: 警告: 隐式声明函数‘fls’
/usr/src/linux-headers-2.6.24-16/include/linux/bitops.h: 在函数‘hweight_long’中:
/usr/src/linux-headers-2.6.24-16/include/linux/bitops.h:45: 警告: 隐式声明函数‘hweight32’
/usr/src/linux-headers-2.6.24-16/include/linux/bitops.h:45: 警告: 隐式声明函数‘hweight64’
/usr/src/linux-headers-2.6.24-16/include/linux/bitops.h: 在函数‘fls_long’中:
/usr/src/linux-headers-2.6.24-16/include/linux/bitops.h:72: 警告: 隐式声明函数‘fls64’
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:16,
from /usr/src/linux-headers-2.6.24-16/include/linux/cache.h:4,
from /usr/src/linux-headers-2.6.24-16/include/linux/time.h:7,
from /usr/src/linux-headers-2.6.24-16/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:10,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/log2.h: 在文件层:
/usr/src/linux-headers-2.6.24-16/include/linux/log2.h:32: 错误: expected ‘)’ before ‘n’
/usr/src/linux-headers-2.6.24-16/include/linux/log2.h:40: 错误: expected ‘)’ before ‘n’
/usr/src/linux-headers-2.6.24-16/include/linux/log2.h:52: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘is_power_of_2’
在包含自 /usr/src/linux-headers-2.6.24-16/include/linux/cache.h:4 的文件中,
从 /usr/src/linux-headers-2.6.24-16/include/linux/time.h:7,
从 /usr/src/linux-headers-2.6.24-16/include/linux/stat.h:60,
从 /usr/src/linux-headers-2.6.24-16/include/linux/module.h:10,
从 hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:18:21: 错误: asm/bug.h:没有该文件或目录
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/cache.h:4,
from /usr/src/linux-headers-2.6.24-16/include/linux/time.h:7,
from /usr/src/linux-headers-2.6.24-16/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:10,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:148: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:149: 错误: 格式字符串实参不是字符串型
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:149: 警告: 与内建函数‘snprintf’类型冲突
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:150: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:151: 警告: 与内建函数‘vsnprintf’类型冲突
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:152: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:153: 错误: 格式字符串实参不是字符串型
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:154: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:201: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘printk_timed_ratelimit’
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:251: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:253: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:253: 错误: expected declaration specifiers or ‘...’ before ‘bool’
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:256: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:256: 错误: expected declaration specifiers or ‘...’ before ‘bool’
/usr/src/linux-headers-2.6.24-16/include/linux/kernel.h:258: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/preempt.h:9,
from /usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h:49,
from /usr/src/linux-headers-2.6.24-16/include/linux/seqlock.h:29,
from /usr/src/linux-headers-2.6.24-16/include/linux/time.h:8,
from /usr/src/linux-headers-2.6.24-16/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:10,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:23: 错误: expected specifier-qualifier-list before ‘u32’
在包含自 /usr/src/linux-headers-2.6.24-16/include/linux/preempt.h:9 的文件中,
从 /usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h:49,
从 /usr/src/linux-headers-2.6.24-16/include/linux/seqlock.h:29,
从 /usr/src/linux-headers-2.6.24-16/include/linux/time.h:8,
从 /usr/src/linux-headers-2.6.24-16/include/linux/stat.h:60,
从 /usr/src/linux-headers-2.6.24-16/include/linux/module.h:10,
从 hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:34:29: 错误: asm/thread_info.h:没有该文件或目录
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:43: 警告: ‘struct thread_info’在形参表内部声明
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:43: 警告: 它的作用域仅限于此定义或声明,这可能并不是您想要的
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h: 在函数‘set_ti_thread_flag’中:
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:45: 警告: 隐式声明函数‘set_bit’
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:45: 错误: 提领指向不完全类型的指针
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h: 在文件层:
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:48: 警告: ‘struct thread_info’在形参表内部声明
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h: 在函数‘clear_ti_thread_flag’中:
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:50: 警告: 隐式声明函数‘clear_bit’
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:50: 错误: 提领指向不完全类型的指针
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h: 在文件层:
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:53: 警告: ‘struct thread_info’在形参表内部声明
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h: 在函数‘test_and_set_ti_thread_flag’中:
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:55: 警告: 隐式声明函数‘test_and_set_bit’
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:55: 错误: 提领指向不完全类型的指针
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h: 在文件层:
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:58: 警告: ‘struct thread_info’在形参表内部声明
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h: 在函数‘test_and_clear_ti_thread_flag’中:
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:60: 警告: 隐式声明函数‘test_and_clear_bit’
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:60: 错误: 提领指向不完全类型的指针
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h: 在文件层:
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:63: 警告: ‘struct thread_info’在形参表内部声明
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h: 在函数‘test_ti_thread_flag’中:
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:65: 警告: 隐式声明函数‘test_bit’
/usr/src/linux-headers-2.6.24-16/include/linux/thread_info.h:65: 错误: 提领指向不完全类型的指针
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/seqlock.h:29,
from /usr/src/linux-headers-2.6.24-16/include/linux/time.h:8,
from /usr/src/linux-headers-2.6.24-16/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:10,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h: 在文件层:
/usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h:297: 错误: expected declaration specifiers or ‘...’ before ‘bool’
/usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h: 在函数‘double_spin_lock’中:
/usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h:301: 错误: ‘l1_first’未声明 (在此函数内第一次使用)
/usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h:301: 错误: (即使在一个函数内多次出现,每个未声明的标识符在其
/usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h:301: 错误: 所在的函数内也只报告一次。)
/usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h: 在文件层:
/usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h:316: 错误: expected declaration specifiers or ‘...’ before ‘bool’
/usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h: 在函数‘double_spin_unlock’中:
/usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h:320: 错误: ‘l1_taken_first’未声明 (在此函数内第一次使用)
在包含自 /usr/src/linux-headers-2.6.24-16/include/linux/seqlock.h:29 的文件中,
从 /usr/src/linux-headers-2.6.24-16/include/linux/time.h:8,
从 /usr/src/linux-headers-2.6.24-16/include/linux/stat.h:60,
从 /usr/src/linux-headers-2.6.24-16/include/linux/module.h:10,
从 hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h:333:24: 错误: asm/atomic.h:没有该文件或目录
/usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h: 在文件层:
/usr/src/linux-headers-2.6.24-16/include/linux/spinlock.h:339: 错误: expected ‘)’ before ‘*’ token
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/time.h:8,
from /usr/src/linux-headers-2.6.24-16/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:10,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/seqlock.h: 在函数‘read_seqbegin’中:
/usr/src/linux-headers-2.6.24-16/include/linux/seqlock.h:89: 警告: 隐式声明函数‘smp_rmb’
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:10,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/time.h: 在文件层:
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:14: 错误: expected specifier-qualifier-list before ‘time_t’
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:20: 错误: expected specifier-qualifier-list before ‘time_t’
/usr/src/linux-headers-2.6.24-16/include/linux/time.h: 在函数‘timespec_equal’中:
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:43: 错误: ‘const struct timespec’没有名为‘tv_sec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:43: 错误: ‘const struct timespec’没有名为‘tv_sec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:43: 错误: ‘const struct timespec’没有名为‘tv_nsec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:43: 错误: ‘const struct timespec’没有名为‘tv_nsec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h: 在函数‘timespec_compare’中:
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:53: 错误: ‘const struct timespec’没有名为‘tv_sec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:53: 错误: ‘const struct timespec’没有名为‘tv_sec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:55: 错误: ‘const struct timespec’没有名为‘tv_sec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:55: 错误: ‘const struct timespec’没有名为‘tv_sec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:57: 错误: ‘const struct timespec’没有名为‘tv_nsec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:57: 错误: ‘const struct timespec’没有名为‘tv_nsec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h: 在函数‘timeval_compare’中:
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:62: 错误: ‘const struct timeval’没有名为‘tv_sec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:62: 错误: ‘const struct timeval’没有名为‘tv_sec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:64: 错误: ‘const struct timeval’没有名为‘tv_sec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:64: 错误: ‘const struct timeval’没有名为‘tv_sec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:66: 错误: ‘const struct timeval’没有名为‘tv_usec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:66: 错误: ‘const struct timeval’没有名为‘tv_usec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h: 在文件层:
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:73: 错误: expected declaration specifiers or ‘...’ before ‘time_t’
/usr/src/linux-headers-2.6.24-16/include/linux/time.h: 在函数‘timespec_sub’中:
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:82: 错误: ‘struct timespec’没有名为‘tv_sec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:82: 错误: ‘struct timespec’没有名为‘tv_sec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:83: 错误: ‘struct timespec’没有名为‘tv_nsec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:83: 错误: ‘struct timespec’没有名为‘tv_nsec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:83: 错误: 提供给函数‘set_normalized_timespec’的实参太多
/usr/src/linux-headers-2.6.24-16/include/linux/time.h: 在文件层:
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:133: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘timespec_to_ns’
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:145: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘timeval_to_ns’
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:157: 警告: 在‘s64’的声明中,类型默认为‘int’
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:157: 错误: expected ‘;’, ‘,’ or ‘)’ before ‘nsec’
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:165: 警告: 在‘s64’的声明中,类型默认为‘int’
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:165: 错误: expected ‘;’, ‘,’ or ‘)’ before ‘nsec’
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:172: 错误: expected declaration specifiers or ‘...’ before ‘u64’
/usr/src/linux-headers-2.6.24-16/include/linux/time.h: 在函数‘timespec_add_ns’中:
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:174: 错误: ‘ns’未声明 (在此函数内第一次使用)
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:174: 错误: ‘struct timespec’没有名为‘tv_nsec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:177: 错误: ‘struct timespec’没有名为‘tv_sec’的成员
/usr/src/linux-headers-2.6.24-16/include/linux/time.h:179: 错误: ‘struct timespec’没有名为‘tv_nsec’的成员
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:10,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/stat.h: 在文件层:
/usr/src/linux-headers-2.6.24-16/include/linux/stat.h:63: 错误: expected specifier-qualifier-list before ‘u64’
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:14,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/elf.h:396: 错误: expected declaration specifiers or ‘...’ before ‘loff_t’
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/kobject.h:24,
from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:16,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/sysfs.h:30: 错误: expected specifier-qualifier-list before ‘mode_t’
/usr/src/linux-headers-2.6.24-16/include/linux/sysfs.h:64: 错误: expected specifier-qualifier-list before ‘size_t’
/usr/src/linux-headers-2.6.24-16/include/linux/sysfs.h:75: 错误: expected specifier-qualifier-list before ‘ssize_t’
/usr/src/linux-headers-2.6.24-16/include/linux/sysfs.h:153: 错误: expected declaration specifiers or ‘...’ before ‘mode_t’
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/kobject.h:27,
from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:16,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/kref.h:24: 错误: expected specifier-qualifier-list before ‘atomic_t’
在包含自 /usr/src/linux-headers-2.6.24-16/include/linux/kobject.h:29 的文件中,
从 /usr/src/linux-headers-2.6.24-16/include/linux/module.h:16,
从 hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/wait.h:26:25: 错误: asm/current.h:没有该文件或目录
In file included from /usr/src/linux-headers-2.6.24-16/include/linux/module.h:16,
from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/kobject.h:41: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘uevent_seqnum’
/usr/src/linux-headers-2.6.24-16/include/linux/kobject.h:228: 错误: expected specifier-qualifier-list before ‘ssize_t’
/usr/src/linux-headers-2.6.24-16/include/linux/kobject.h:256: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
在包含自 hello.c:1 的文件中:
/usr/src/linux-headers-2.6.24-16/include/linux/module.h:19:23: 错误: asm/local.h:没有该文件或目录
/usr/src/linux-headers-2.6.24-16/include/linux/module.h:21:24: 错误: asm/module.h:没有该文件或目录
In file included from hello.c:1:
/usr/src/linux-headers-2.6.24-16/include/linux/module.h:49: 错误: expected specifier-qualifier-list before ‘ssize_t’
hello.c:15: 错误: 对‘init_module’的静态声明出现在非静态声明之后
/usr/src/linux-headers-2.6.24-16/include/linux/module.h:65: 错误: ‘init_module’的上一个声明在此
hello.c:21: 错误: 对‘cleanup_module’的静态声明出现在非静态声明之后
/usr/src/linux-headers-2.6.24-16/include/linux/module.h:66: 错误: ‘cleanup_module’的上一个声明在此


最后由 lsxycc 编辑于 2008-09-26 23:23,总共编辑了 2 次

页首
 用户资料  
 
2 楼 
 文章标题 : Re: [求助]编译驱动程序出错
帖子发表于 : 2008-09-26 16:31 

注册: 2007-09-22 23:34
帖子: 9
送出感谢: 0 次
接收感谢: 0 次
把错误和代码贴出来啊,不然咋判断?


页首
 用户资料  
 
3 楼 
 文章标题 : Re: [求助]编译hello world模块出错
帖子发表于 : 2008-10-10 16:31 

注册: 2007-12-27 20:50
帖子: 46
送出感谢: 0 次
接收感谢: 0 次
问题很简单,因为用2.6的内核做驱动模块的话,要建立内核树,建议您看一下http://forum.ubuntu.org.cn/viewtopic.php?f=97&t=109762


页首
 用户资料  
 
4 楼 
 文章标题 : Re: [求助]编译hello world模块出错
帖子发表于 : 2008-10-11 19:51 

注册: 2008-08-17 6:09
帖子: 43
送出感谢: 0 次
接收感谢: 0 次
:em02


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 4 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 2 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译