module compile problem
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > module compile problem




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    module compile problem  
zz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-12-06 12:47 PM

a "hello world" module sample in ldd3:
////////////////////////////////////////////////
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");

static int hello_init(void)
{
printk(KERN_ALERT "Hello, World!\n");
return 0;
}

static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world!\n");
}
module_init(hello_init);
module_exit(hello_exit);
//////////////////////////////////////////
i compiled it with gcc:
//////////////////////////////////////////
$gcc -c -I/usr/src/linux/include hello.c
//////////////////////////////////////////
but it generated a ton of such error:
////////////////////////////////////////////
/usr/src/linux/include/linux/time.h:13: error: syntax error before 'time_t'
/usr/src/linux/include/linux/time.h:13: warning: no semicolon at end of stru
ct or union
/usr/src/linux/include/linux/time.h:15: error: syntax error before '}' token
/usr/src/linux/include/linux/time.h:19: error: syntax error before 'time_t'
/usr/src/linux/include/linux/time.h:19: warning: no semicolon at end of stru
ct or union
/usr/src/linux/include/linux/time.h:20: warning: data definition has no type
 or
storage class
/usr/src/linux/include/linux/time.h:136: error: field 'it_interval' has inco
mplete type
/usr/src/linux/include/linux/time.h:137: error: field 'it_value' has incompl
ete
type
/usr/src/linux/include/linux/time.h:141: error: field 'it_interval' has inco
mplete type
/usr/src/linux/include/linux/time.h:142: error: field 'it_value' has incompl
ete
type
In file included from /usr/src/linux/include/linux/sched.h:11,
//////////////////////////////////////////
who can tell me why?? thanks a lot!!!






[ Post a follow-up to this message ]



    Re: module compile problem  
Fletcher Glenn


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-13-06 10:54 PM

zz wrote:
> a "hello world" module sample in ldd3:
> ////////////////////////////////////////////////
> #include <linux/init.h>
> #include <linux/module.h>
> MODULE_LICENSE("Dual BSD/GPL");
>
> static int hello_init(void)
> {
>         printk(KERN_ALERT "Hello, World!\n");
>         return 0;
> }
>
> static void hello_exit(void)
> {
>         printk(KERN_ALERT "Goodbye, cruel world!\n");
> }
> module_init(hello_init);
> module_exit(hello_exit);
> //////////////////////////////////////////
> i compiled it with gcc:
> //////////////////////////////////////////
> $gcc -c -I/usr/src/linux/include hello.c
> //////////////////////////////////////////
> but it generated a ton of such error:
> ////////////////////////////////////////////
> /usr/src/linux/include/linux/time.h:13: error: syntax error before 'time_t
'
> /usr/src/linux/include/linux/time.h:13: warning: no semicolon at end of st
ruct or union
> /usr/src/linux/include/linux/time.h:15: error: syntax error before '}' tok
en
> /usr/src/linux/include/linux/time.h:19: error: syntax error before 'time_t
'
> /usr/src/linux/include/linux/time.h:19: warning: no semicolon at end of st
ruct or union
> /usr/src/linux/include/linux/time.h:20: warning: data definition has no ty
pe or
> storage class
> /usr/src/linux/include/linux/time.h:136: error: field 'it_interval' has in
complete type
> /usr/src/linux/include/linux/time.h:137: error: field 'it_value' has incom
plete
> type
> /usr/src/linux/include/linux/time.h:141: error: field 'it_interval' has in
complete type
> /usr/src/linux/include/linux/time.h:142: error: field 'it_value' has incom
plete
> type
> In file included from /usr/src/linux/include/linux/sched.h:11,
> //////////////////////////////////////////
> who can tell me why?? thanks a lot!!!
>

You apparently have indirectly included <linux/time.h> without including
a prerequisite file that defines something needed by this header file.

--

Fletcher Glenn






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 02:27 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register