1. It doesn't, of course, matter where you build your module.
2. It matters very much, however, that a kernel module be specially built *as* a kernel module. Here is a link on compiling kernel modules:
3. It's also essential that you *not* call user-space runtime library functions (like "printf()") from a kernel module.