Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22075

How to include headers from another directory (but not knowing which)

$
0
0

I am trying to compile module. I can do so by calling make, which calls

make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules

But I want to see preprocessed output, So I am trying to compile manually with cc -E file.c. The problem is, It cannot see header <linux/init.h>:

fatal error: linux/init.h: No such file or directory #include <linux/init.h>

I have notice, when make is called, it first enter this dir /usr/src/linux-headers-5.0.0-38-generic, There is probably the header, but I do not know where. I have tried gcc -E -I'/usr/src/linux-headers-5.0.0-38-generic file.c, but still the same error. So how is possible to include kernel headers (which <linux/init.h> is) in user mode - that is how to include headers from another dir?

PS: as @uzsolt in comments suggested, I add include to the end of path: gcc -I /usr/src/linux-headers-5.0.0-38-generic/include. But then another header is missing - <asm/linkage.h>, and again - I have no clue in what dir this header is.


Viewing all articles
Browse latest Browse all 22075

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>