Joran 发表于 2003-9-9 18:43:01

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。
忘高手赐教,感激不尽。

Dragonfly 发表于 2003-9-10 10:26:40

what is u make file? post its content here,

btw, search the forum, there is an example about this,

Joran 发表于 2003-9-10 11:16:56

谢谢斑竹:)
我没有使用make file,书上也没有。
我只是:

#gcc -c hello.c

另外,您说的那篇文章我没找到。:(

keenor 发表于 2003-9-10 19:12:42

http://www.linuxfans.org/nuke/modules.php?name=Forums&file=viewtopic&t=17245&start=15&postdays=0&postorder=asc&highlight=

以后要知道自己找

Dragonfly 发表于 2003-9-11 01:14:04

thx keenor,:-D:-D:-D

Joran 发表于 2003-9-11 22:54:07

谢谢keenor和Dragonfly两位大哥。

PS. Dragonfly大哥的E文这么强,羡慕啊。:)

Dragonfly 发表于 2003-9-12 08:34:17

不强, 呵呵。

嗨, 输入中文太慢。 不好玩。 :-(

Joran 发表于 2003-9-12 10:10:28

别谦虚啊。
大家都在向你学习呢:)

nose_roxete 发表于 2003-9-12 14:08:23

Brother Dragonfly, when do u begin to input Chinese instead of English!!

hoho, this is the first time i've seen that!

keenor 发表于 2003-9-12 22:13:04

真难得啊 :P:P:P

Dragonfly 发表于 2003-9-13 08:37:36

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

Joran 发表于 2003-9-13 09:30:31

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:

nose_roxete 发表于 2003-9-13 09:52:48

i believe reading some english is really good to most of you.

i do think so!!
no good english, no good linux.
hoho!

keenor 发表于 2003-9-13 10:06:23

i type the keyboard still with two fingers are i use it for 10 years.
oh, my god!
:lol:   :lol::lol:

Dragonfly 发表于 2003-9-13 23:10:35

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]
查看完整版本: ldd2的helloworld编译通不过,请高手赐教!