linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* compiling errors
@ 2002-10-01 18:07 immortal1015
  2002-10-01 18:22 ` Arjan van de Ven
  0 siblings, 1 reply; 4+ messages in thread
From: immortal1015 @ 2002-10-01 18:07 UTC (permalink / raw)
  To: linux-kernel

I tried to compile the very simple kernel module code as following.
I compile this code using gcc -c hello.c, but gcc tell me:
 /usr/include/linux	/module.h:60 parse error before 'atomic_t'

What is the error? My gcc version is 2.96.


//////////////////////////////////////////////////////////////////////////////
#ifndef __KERNEL__
#  define __KERNEL__
#endif
#ifndef MODULE
#  define MODULE
#endif
#include <linux/version.h>
#include <linux/config.h>
#include <linux/module.h>

#include <linux/kernel.h> /* printk */

int init_module(void)
{
	printk("<1>Hello the world\n");
	return 0;
}

void cleanup_module(void)
{
	printk("<1>Goodbye the world\n");	
}
/////////////////////////////////////////////////////////////////


Best regards
yours Brucie





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: compiling errors
  2002-10-01 18:07 compiling errors immortal1015
@ 2002-10-01 18:22 ` Arjan van de Ven
  0 siblings, 0 replies; 4+ messages in thread
From: Arjan van de Ven @ 2002-10-01 18:22 UTC (permalink / raw)
  To: immortal1015; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 376 bytes --]

On Tue, 2002-10-01 at 20:07, immortal1015 wrote:
> I tried to compile the very simple kernel module code as following.
> I compile this code using gcc -c hello.c, but gcc tell me:
>  /usr/include/linux	/module.h:60 parse error before 'atomic_t'

you are using glibc headers to compile kernel code....

add -I/lib/modules/`uname -r`/build/include
to the gcc flags



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: compiling errors
  2002-10-01 18:53 immortal1015
@ 2002-10-01 19:20 ` Richard B. Johnson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard B. Johnson @ 2002-10-01 19:20 UTC (permalink / raw)
  To: immortal1015; +Cc: linux-kernel

On Wed, 2 Oct 2002, immortal1015 wrote:

> I tried to compile the very simple kernel module code as following.
> I compile this code using gcc -c hello.c, but gcc tell me:
>  /usr/include/linux	/module.h:60 parse error before 'atomic_t'
> 
> What is the error? My gcc version is 2.96 and Redhat Linux 7.3


Script started on Tue Oct  1 15:15:14 2002
# cat >zzz.c
#ifndef __KERNEL__
#  define __KERNEL__
#endif
#ifndef MODULE
#  define MODULE
#endif
#include <linux/version.h>
#include <linux/config.h>
#include <linux/module.h>

#include <linux/kernel.h> /* printk */

int init_module(void)
{
	printk("<1>Hello the world\n");
	return 0;
}

void cleanup_module(void)
{
	printk("<1>Goodbye the world\n");	
}
# gcc -Wall -O2 -c -o zzz.o zzz.c
# insmod zzz.o
# rmmod zzz
# tail /var/s\b \blog/messages
Oct  1 01:02:36 chaos sendmail[26509]: g9152V126509: <pine.lnx.3.95.1010126095653.762a-100000@chaos.analogic.com>... User unknown
Oct  1 07:23:15 chaos login: ROOT LOGIN ON tty1
Oct  1 07:28:23 chaos sendmail[27618]: g91BSK127618: <100000@chaos.analogic.com>... User unknown
Oct  1 07:31:32 chaos sendmail[27648]: alias database /etc/mail/aliases rebuilt by root
Oct  1 08:16:18 chaos login: ROOT LOGIN ON tty2
Oct  1 11:13:46 chaos sendmail[30538]: g91FDf130538: <Pine.LNX.3.95.971112180225.1589A-100000@chaos.analogic.com>... User unknown
Oct  1 15:15:53 chaos kernel: Hello the world 
Oct  1 15:16:01 chaos kernel: Goodbye the world 
# exit
exit

Script done on Tue Oct  1 15:16:30 2002



Works here. You may have to always used -O2 to get in-lines to
work correctly.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
The US military has given us many words, FUBAR, SNAFU, now ENRON.
Yes, top management were graduates of West Point and Annapolis.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* compiling errors
@ 2002-10-01 18:53 immortal1015
  2002-10-01 19:20 ` Richard B. Johnson
  0 siblings, 1 reply; 4+ messages in thread
From: immortal1015 @ 2002-10-01 18:53 UTC (permalink / raw)
  To: linux-kernel

I tried to compile the very simple kernel module code as following.
I compile this code using gcc -c hello.c, but gcc tell me:
 /usr/include/linux	/module.h:60 parse error before 'atomic_t'

What is the error? My gcc version is 2.96 and Redhat Linux 7.3


//////////////////////////////////////////////////////////////////////////////
#ifndef __KERNEL__
#  define __KERNEL__
#endif
#ifndef MODULE
#  define MODULE
#endif
#include <linux/version.h>
#include <linux/config.h>
#include <linux/module.h>

#include <linux/kernel.h> /* printk */

int init_module(void)
{
	printk("<1>Hello the world\n");
	return 0;
}

void cleanup_module(void)
{
	printk("<1>Goodbye the world\n");	
}
/////////////////////////////////////////////////////////////////


Best regards
yours Brucie




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-01 19:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-01 18:07 compiling errors immortal1015
2002-10-01 18:22 ` Arjan van de Ven
2002-10-01 18:53 immortal1015
2002-10-01 19:20 ` Richard B. Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).