From mboxrd@z Thu Jan 1 00:00:00 1970 From: krinkin.m.u@gmail.com (Mike Krinkin) Date: Mon, 25 Jul 2016 21:16:53 +0300 Subject: help please first module In-Reply-To: References: Message-ID: <20160725181651.GA12152@gmail.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Mon, Jul 25, 2016 at 08:04:41PM +0200, hinawa wrote: > hello i am starting to write modules and this code does not compile > > hello.c: > > /******************** > > Modulo experimental > > ********************/* Probably, error is in the line above. > > #include > #include > #include > > MODULE_LICENSE("GPL"); > MODULE_AUTHOR("Alberto Cerezo "); > MODULE_DESCRIPTION("\"Hola Mundo\" Modulo experimental"); > MODULE_VERSION("printk"); > > static int __init hola_init(void) > { > printk(KERN_INFO "Hola mundo\n"); > return 0; > } > > > static void __exit hola_exit(void) > { > printk(KERN_INFO "Adios, me marcho\n"); > } > > module_init(hola_init); > module_exit(hola_exit); > > > Makefile: > > obj-m += hello.o > > all: > make -C /lib/modules/$(shell uname -r)/build M=${PWD} modules > clean: > make -C /lib/modules/$(shell uname -r)/build M=${PWD} clean > > > error: > > In file included from > /usr/src/linux-headers-4.6.0-1-common/include/linux/init.h:4:0, > from > /home/hinawa/Documentos/programasC/modulos/mod1/hello.c:9: > /usr/src/linux-headers-4.6.0-1-common/include/linux/compiler.h:89:1: > error: expected identifier or ?(? before ?struct? > struct ftrace_branch_data { > ^ > make[4]: *** [/home/hinawa/Documentos/programasC/modulos/mod1/hello.o] > Error 1 > make[3]: *** [_module_/home/hinawa/Documentos/programasC/modulos/mod1] > Error 2 > make[2]: *** [sub-make] Error 2 > make[1]: *** [all] Error 2 > make: *** [all] Error 2 > > > > I do not get to find the error because the code appears to be correct ... > > thks > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies