header file in kernel file

i just wanted to know can we include header file in the file that contains a kernel
thanks in advance

regards
megharaj

Yes, you can include header files in the file that contains a kernel. Please be aware that not all header files are supported, e.g., complex.h, string.h, etc. A more detailed list can be found in the specification document.

I found that using #include “myheader.h” alone doesn’t pull in the header file even if it’s located in the same directory as the executable and kernel file. To get it pulled in I had to pass “-I./” as a program build option.

Does anyone happen to know if the search rules for headers are different inside a kernel file, e.g., #include <myheader.h> and #include “myheader.h”? I was a bit surprised I had to explicitly pass the above program build option.