From Bugzilla Helper: User-Agent: Mozilla/5.0 (compatible; Konqueror/3.0.0-10; Linux) Description of problem: Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1.i write a module . 2. #include <linux/module.h> /* Needed by all modules */ #include <linux/kernel.h> /* Needed for KERN_ALERT */ int init_module(void) { printk("<1>Hello world 1.\n"); /* A non 0 return means init_module failed; module can't be loaded. */ return 0; } void cleanup_module(void) { printk(KERN_ALERT "Goodbye world 1.\n"); } 3. and write Makefile 4. # Makefile for a basic kernel module CC=gcc CFLAGS := -c -0 -W -Wall -Wstrict-prototypes -Wmissing-prototypes MODFLAGS := -DMODULE -D__KERNEL__ hello-1.o: hello.c ${CC} ${MODCFLAGS} hello.c 5. after run make command this erros occurd : 6. gcc hello.c In file included from hello.c: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 `}' hello.c: In function `cleanup_module': hello.c:16: `KERN_ALERT' undeclared (first use in this function) hello.c:16: (Each undeclared identifier is reported only once hello.c:16: for each function it appears in.) hello.c:16: parse error before string constant make: *** [hello-1.o] Error 1 7. i tested it from another computer but both of result are equal please help me My mail is ar_Bahmani Additional info:
Your makefile has a bug that causes it to compile using glibc headers and not kernel headers. You need to add -I/lib/modules/`uname -r'/build/include to the CFLAGS