alexandernst
alexandernst

Reputation: 15109

Check what files is 'make' including

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

Answers (2)

Digital Trauma
Digital Trauma

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

David Ranieri
David Ranieri

Reputation: 41017

cpp code.c | grep unistd.h

or

gcc -E code.c | grep unistd.h

Upvotes: 1

Related Questions