ldd2的helloworld编译通不过,请高手赐教!
我买了《linux设备驱动》第二版。但我编译书中最简单的程序居然通不过,还说是系统的<linux/module.h>文件的错误。
代码:
#define MODULE
#include <linux/module.h>
int init_module(void)
{
printk("<1>Hello, world!\n");
return 0;
}
void cleanup_module(void)
{
printk("<1>Goodbye cruel world\n");
}
出错信息:
/usr/include/linux/module.h:60: parse error before 'atomic_t'
/usr/include/linux/module.h:60: warning: no semicolon at end of struct or union
/usr/include/linux/module.h:60: warning: no semicolon at end of struct or union
/usr/include/linux/module.h:62: parse error before '}'
/usr/include/linux/module.h:62: warning: data definition has no type or storage class
/usr/include/linux/module.h:91: parse error before '}'
我的linux是RH7.3。kernel 2.4.18-3。
忘高手赐教,感激不尽。 what is u make file? post its content here,
btw, search the forum, there is an example about this, 谢谢斑竹:)
我没有使用make file,书上也没有。
我只是:
#gcc -c hello.c
另外,您说的那篇文章我没找到。:( http://www.linuxfans.org/nuke/modules.php?name=Forums&file=viewtopic&t=17245&start=15&postdays=0&postorder=asc&highlight=
以后要知道自己找 thx keenor,:-D:-D:-D 谢谢keenor和Dragonfly两位大哥。
PS. Dragonfly大哥的E文这么强,羡慕啊。:) 不强, 呵呵。
嗨, 输入中文太慢。 不好玩。 :-( 别谦虚啊。
大家都在向你学习呢:) Brother Dragonfly, when do u begin to input Chinese instead of English!!
hoho, this is the first time i've seen that! 真难得啊 :P:P:P i reinstall my laptop to redhat 9 in order to learn more about it. so install a scim as well. but i find that type chinese is really slow. i type the keyboard still with two fingers are i use it for 10 years.:-Dso i think i still will use english to speed up.
and i believe reading some english is really good to most of you. only when necessary, i will try to use chinese, which is too slow and too tough for me now.
:-D:-D:-D type the keyboard still with two fingers?
oh, my god!
We can never imagine that a expert who are eruditional in linux type the keyboard with only two fingers.
:lol::lol::lol: i believe reading some english is really good to most of you.
i do think so!!
no good english, no good linux.
hoho! i type the keyboard still with two fingers are i use it for 10 years.
oh, my god!
:lol: :lol::lol: when i was in undergraduate, i spend most of the time on installing/uninstalling.... all kinds of stuff except the typing exercise. and this situation keeps till now. i should sit down and learn it seriouslly some day.:oops::oops::oops:
页:
[1]