I am trying to include math.h in my Linux kernel module. If I use,
#include '/usr/include/math.h'
It give me theses errors:
error: features.h: No such file or directory
error: bits/huge_val.h: No such file or directory
error: bits/mathdef.h: No such file or directory
error: bits/mathcalls.h: No such file or directory
Why is this?
h is a header file in the standard library of the C programming language designed for basic mathematical operations. Most of the functions involve the use of floating point numbers.
It should be available by default; all you need is #include <math. h> , and the compiler will know where to find it. (So your title is a little misleading.) The functions declared in <math.
The C <math. h> header file declares a set of functions to perform mathematical operations such as: sqrt() to calculate the square root, log() to find natural logarithm of a number etc.
In order to use these functions you need to include header file- <math. h> or <cmath>. double sin(double) : This function takes angle (in radian) as an argument and return its sine value that could be verified using sine curve.
You cannot use the C library in a kernel module, this is even more true for the math library part.
You can't include a userspace C module in kernel space. Also are you sure that you want to be doing this? This thread may help http://kerneltrap.org/node/16570. You can do math functions inside the kernel, just search around on http://lxr.linux.no/ for the function you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With