Home > OS >  Trying to include header for vsnprintf throws error in compiling
Trying to include header for vsnprintf throws error in compiling

Time:11-11

What is the header file for vsnprintf in the kernel? Can anyone please tell me this, I have kernel 5.14 and I am not sure what headers are default on my system. I have a number of different kernel headers installed, these are:

linux-headers-5.11.0-25
linux-headers-5.11.0-40
linux-headers-5.11.0-25-generic
linux-headers-5.11.0-40-generic
linux-headers-5.11.0-38
linux-headers-5.11.0-38-generic

Which one should be the default? But i like to ask what is the header file for function vsnprintf?

CodePudding user response:

Taking a look at the source code for Linux v5.11, the correct header seems to be linux/kernel.h. It's the same file for Linux v5.14.

To check which headers you should use for your currently running kernel use the command uname -r which should tell you the correct version. You can then compile using those and an appropriate Makefile: see the documentation for more info.

  • Related