


$ vi print.iĮxtern FILE *popen (_const char *_command, _const char *_modes) Įxtern char *ctermid (char *_s) _attribute_ ((_nothrow_)) Įxtern void flockfile (FILE *_stream) _attribute_ ((_nothrow_)) Įxtern int ftrylockfile (FILE *_stream) _attribute_ ((_nothrow_)) Įxtern void funlockfile (FILE *_stream) _attribute_ ((_nothrow_))

Now, lets open print.i file and view the content. The preprocessed output is stored in the temporary file that has the extension. So when we compile the program print.c with -save-temps flag we get the following intermediate files in the current directory (along with the print executable) $ ls ‘-save-temps’ flag instructs compiler to store the temporary intermediate files used by the gcc compiler in the current directory. $ gcc -Wall -E print.cĮven better, you can use flag ‘-save-temps’ as shown below. To understand preprocessing better, you can compile the above ‘print.c’ program using flag -E, which will print the preprocessed output to stdout. In this stage the following tasks are done: This is the very first stage through which a source code passes. Now that we have a basic idea about how gcc is used to convert a source code into binary, we’ll review the 4 stages a C program has to go through to become an executable.

Note: When you are working on a big project that contains several C program, use make utility to manage your C program compilation as we discussed earlier. If you don’t specify -o, by default C compiler will create the executable with name a.outįinally, execute print which will execute the C program and display hello world.
