문제

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
도움이 되었습니까?

해결책 2

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top