I'm compiling the following program:
Code:
#include <stdio.h>
void main()
{
printf("Hello World\n");
}
With the following include statement and the associated header file in the same directory as the .c file:
gcc will then compile successfully using the following
$gcc -x none file.c
With the following include statement and the associated header file in /usr/include
gcc will not compile the file using any of the following
$gcc -x c file.c
$gcc -x none file.c
$gcc -std=c89 file.c
Now...how about this...
If I compile a file with the stdio.h header in the same directory, a precompiled header is kicked out: stdio.h.gch
If that .gch file is moved to /usr/include then compilation will proceed without any errors when the following statement is used:
According to: http://gcc.gnu.org/onlinedocs/gcc-3...ed-Headers.html
"...only one precompiled header may be used during any compilation..."
so this proves to be a solution for small projects.
More...if the following is entered, a list of syntax errors results:
$ pwd
/usr/include
$ gcc -x none stdio.h
/usr/include/stdio.h:21 error: syntax error before '*' token
......
GES