user2714949
user2714949

Reputation: 409

Adding userspace header files to make file

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

Upvotes: 0

Views: 654

Answers (2)

user2714949
user2714949

Reputation: 409

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

Upvotes: 0

Some programmer dude
Some programmer dude

Reputation: 409176

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.

Upvotes: 2

Related Questions