View Full Version : Need help : kernel header file

July 25th, 2007, 03:25 AM
Dear all,

I need to compile a C++ program which is using several kernel header files with this kind of writting pattern

#include <linux/xxx.h>

#include <asm/xxx.h>.
The problem is that the compiler cannot find those header files. I have check the kernel header in

And all the files are there. I also boot using that kernel.

Is there anyway to solve this problem without changing the Makefile or the C++ codes?
Or any solutions without changing the C++ codes

By the way, I'm using Ubuntu 7.04 with a custom kernel

July 25th, 2007, 01:51 PM
You could use a command like:

$ CXXFLAGS=-I /usr/src/linux-headers- make
The general convention is to use the CFLAGS (for C - gcc) and CXXFLAGS (for C++ - g++) env. variable to specify the options passed to the compiler.
So, if your Makefile is written according to the convention, the above command should work fine.

But, I doubt you can use the kernel code (function declarations etc) in any C++ code.
I hope you know what you're doing.
All the best ;)

July 26th, 2007, 06:55 AM
It works, thanks