I am trying to do some Linux Kernel programming with CLion. I observe that some headers, like <linux/kernel.h>
and <linux/module.h>
are correctly recognized, but some others, like <linux/init.h>
are not.
To be more clear, here is a sample program:
1 #include <linux/init.h>
2 #include <linux/kernel.h>
3
4 int init_module(void) {
5 printk("initializing");
6 return 0;
7 }
Here I have rows 1 and 5 highlighted in red with the typical “file not found”/”call to undeclared function” errors, but row 2 is correctly non-highlighted, and if I try to write something that is linked to that library there is no problem at all.
I have tried to install the latest headers for my kernel, i.e. sudo apt install linux-headers-$(uname -r)
, but it does not seem to work. What can I do?