All of lore.kernel.org
 help / color / mirror / Atom feed
From: krinkin.m.u@gmail.com (Mike Krinkin)
To: kernelnewbies@lists.kernelnewbies.org
Subject: help please first module
Date: Mon, 25 Jul 2016 21:16:53 +0300	[thread overview]
Message-ID: <20160725181651.GA12152@gmail.com> (raw)
In-Reply-To: <d70f32f4-0751-241b-98f6-2ac8a1da3a2e@gmail.com>

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 <linux/init.h>
> #include <linux/module.h>
> #include <linux/kernel.h>
> 
> MODULE_LICENSE("GPL");
> MODULE_AUTHOR("Alberto Cerezo <ac90869@gmail.com>");
> 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

  reply	other threads:[~2016-07-25 18:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-25 18:04 help please first module hinawa
2016-07-25 18:16 ` Mike Krinkin [this message]
2016-07-26  1:40   ` Rajesh Bhaskaran
2016-07-26 13:47     ` hinawa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160725181651.GA12152@gmail.com \
    --to=krinkin.m.u@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.