Question

I am building a linux device using make and i need to use string.h in my device. I tried to add /usr/include to make file but it does not work. can any one help me on adding another include path to make file. my make file is

KBUILD_CFLAGS += -w

obj-m += netlinkKernel.o

all:
    make -w -C /lib/modules/$(shell uname -r)/build CPPFLAGS="usr/include/" M=$(PWD) modules

clean:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Was it helpful?

Solution 2

it seems like we can not use standard header files in kernel programming. Thanks for your help

OTHER TIPS

That's because just usr/include/ isn't a proper compiler flag. You need to use e.g. -I/usr/include/.

However, using libraries from userspace in a kernel driver might not work as you expect it to, like not at all. The kernel should have have it's own string library (including the "string.h" header file) that you should use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top