Reputation: 15109
I'm compiling a kernel module and I'm including <asm/unistd.h>
, but I'm not sure if the compiler is using the unistd.h
from /usr/includes/
(wrong) or the one from /usr/src/kernel-3.x.x/arch/x86/includes/
(right).
My question is: How can I check which one of those two is the compiler using?
And also, is there a way to force the file from the kernel headers instead of the one from /usr/include
?
Upvotes: 2
Views: 58
Reputation: 15996
To answer the second part of your question:
And also, is there a way to force the file from the kernel headers instead of the one from /usr/include
?
You can pass the -nostdinc
option to gcc
:
"Do not search the standard system directories for header files. Only the directories you have specified with -I options (and the directory of the current file, if appropriate) are searched."
GCC: Options Controlling the Preprocessor
Upvotes: 1
Reputation: 41017
cpp code.c | grep unistd.h
or
gcc -E code.c | grep unistd.h
Upvotes: 1