The Four Stages of Compiling a C Program
1. Preprocessing
--> Removal of Comments
--> Include the header files
--> Replacement of Macros
Command to generate the Preprocessing file.
$cc -E test.c -o test.i
2. Translator
--> Checking the Syntax errors
--> Translate c program into Assembly language.
Command to generate the Translator file.
$cc -S test.i -o test.s
3. Assembly
--> Assembly convert the program into machine understanding program.
Command to generate the Assembly file.
$cc -c test.s -o test.o
4. Linking
--> Link the depended libraries
--> Adding additional OS related information
--> Create the executable file
Command to generate the final file.
$cc test.c -o test
1. Preprocessing
--> Removal of Comments
--> Include the header files
--> Replacement of Macros
Command to generate the Preprocessing file.
$cc -E test.c -o test.i
2. Translator
--> Checking the Syntax errors
--> Translate c program into Assembly language.
Command to generate the Translator file.
$cc -S test.i -o test.s
3. Assembly
--> Assembly convert the program into machine understanding program.
Command to generate the Assembly file.
$cc -c test.s -o test.o
4. Linking
--> Link the depended libraries
--> Adding additional OS related information
--> Create the executable file
Command to generate the final file.
$cc test.c -o test
No comments:
Post a Comment