"Invalid module format" when inserting a custom Linux kernel module [migrated]

view story

http://unix.stackexchange.com – I'm trying to write a Linux kernel module, but I'm stuck just writing some stub code. I've compiled this code in Ubuntu: #include <linux/module.h> int init_module(void){ printk("<1> hellp"); return 0;} void cleanup_module(void){ printk("<1> bye");} However, when I try to insmod it I get the error: Invalid module format After googling I figured it may be some problem with version compatibility, but I'm not sure. What am I doing wrong? (HowTos)