QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1476|回复: 14

ldd2的helloworld编译通不过,请高手赐教!

[复制链接]
发表于 2003-9-9 18:43:01 | 显示全部楼层 |阅读模式
我买了《linux设备驱动》第二版。
但我编译书中最简单的程序居然通不过,还说是系统的<linux/module.h>文件的错误。
代码:

[code:1]
#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");
}
[/code:1]


出错信息:
[code:1]
/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 '}'
[/code:1]

我的linux是RH7.3。kernel 2.4.18-3。
忘高手赐教,感激不尽。
发表于 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,
回复

使用道具 举报

 楼主| 发表于 2003-9-10 11:16:56 | 显示全部楼层
谢谢斑竹:)
我没有使用make file,书上也没有。
我只是:
[code:1]
#gcc -c hello.c
[/code:1]
另外,您说的那篇文章我没找到。:(
回复

使用道具 举报

发表于 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=

以后要知道自己找
回复

使用道具 举报

发表于 2003-9-11 01:14:04 | 显示全部楼层
thx keenor,      
回复

使用道具 举报

 楼主| 发表于 2003-9-11 22:54:07 | 显示全部楼层
谢谢keenor和Dragonfly两位大哥。

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

使用道具 举报

发表于 2003-9-12 08:34:17 | 显示全部楼层
不强, 呵呵。

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

使用道具 举报

 楼主| 发表于 2003-9-12 10:10:28 | 显示全部楼层
别谦虚啊。
大家都在向你学习呢
回复

使用道具 举报

发表于 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!
回复

使用道具 举报

发表于 2003-9-12 22:13:04 | 显示全部楼层
真难得啊     
回复

使用道具 举报

发表于 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.    so 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.
    
回复

使用道具 举报

 楼主| 发表于 2003-9-13 09:30:31 | 显示全部楼层
[code:1]type the keyboard still with two fingers?[/code:1]
oh, my god!
We can never imagine that a expert who are eruditional in linux type the keyboard with only two fingers.
    
回复

使用道具 举报

发表于 2003-9-13 09:52:48 | 显示全部楼层
[quote:114b91574a="Dragonfly"]i believe reading some english is really good to most of you. [/quote]

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

使用道具 举报

发表于 2003-9-13 10:06:23 | 显示全部楼层
[quote:e04d888582="Dragonfly"]i type the keyboard still with two fingers are i use it for 10 years.[/quote]
oh, my god!
     
回复

使用道具 举报

发表于 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.      
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-16 09:21 , Processed in 0.043784 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表