#include <filename> - include file "filename" from the C's standard include directory (which is: /usr/include) #include "filename" - include file "filename" from a user specified diretory |
The default user specified include directory is:
|
gcc -Idir1 -Idir2 .... C-program |
The C compiler will look for include files included with #include "..." in directories dir1, dir2, etc.
|
header1.h | include1.c |
---|---|
#define square(x) ((x)*(x)) #define MAX 99999 |
#include "header1.h" int main( int argc, char* argv[] ) { int A[MAX]; int a, b; A[5] = square( a+b ); } |
Output of gcc -E include1.c:
int main( ) { int A[99999]; int a, b; A[5] = ((a+b)*(a+b)); } |
|
|
|
How to run the program:
|
|
#include "recurse.h" // Include the header file itself... #define MAX 99999 |
Result:
recurse.h:2:21: error: #include nested too deeply |
You must scroll back a lot to see the error !!!
Or, use this command (that will send the normal output to the null device so you can see the error message):
gcc -E include-r.c > /dev/null |
How to run the program:
|