SAVE PREPROCESSOR OUTPUT
root@dev:~$ nano programName.c
#include <stdio.h>
int main(void)
{
printf("Hello World\n");
return 0;
}
root@dev:~$ gcc -E programName.c -o programName.i
* the -E option allows the programmer to save the outputs of the PREPROCESSOR!
- -E Preprocess only; do not compile, assemble or link.
root@dev:~$ ls
programName.c programName.i
root@dev:~$ cat programName.i
## 1 "tiny_program.c"
## 1 "<built-in>"
## 1 "<command-line>"
## 31 "<command-line>"
## 1 "/usr/include/stdc-predef.h" 1 3 4
## 32 "<command-line>" 2
## 1 "tiny_program.c"
## 1 "/usr/include/stdio.h" 1 3 4
## 27 "/usr/include/stdio.h" 3 4
## 1 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 1 3 4
## 33 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 3 4
## 1 "/usr/include/features.h" 1 3 4
## 424 "/usr/include/features.h" 3 4
## 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4
## 427 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4
## 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4
## 428 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4
## 1 "/usr/include/x86_64-linux-gnu/bits/long-double.h" 1 3 4
## 429 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4
## 425 "/usr/include/features.h" 2 3 4
## 448 "/usr/include/features.h" 3 4
## 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4
## 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4
## 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4
## 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4
## 449 "/usr/include/features.h" 2 3 4
## 34 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 2 3 4
## 28 "/usr/include/stdio.h" 2 3 4
**** About 700 lines ****
extern void funlockfile (FILE*__stream) __attribute__((__nothrow__,__leaf__));
## 868 "/usr/include/stdio.h" 3 4
## 2 "tiny_program.c" 2
## 3 "tiny_program.c"
int main(void)
{
printf("Hello World\n");
return 0;
}
* ONLY the last four lines are C source code; the rest are code included in the
program by the preprocessor
- all of these code are passed to the gcc compiler!
Last updated