(ii) GCC tool chain
1.GCC is the GNU Compiler collection The GNU compiler family
2. Simple compilation
Example: #include <stdio.h>
int main ()
{
printf ("Hello world!\n");
Return0;
}
Compile instruction gcc Test.c-o test to generate the test executable./test execution
3. Compile Four Stages
(1) Preprocessing (header file expansion)
Example: Gcc-e test.c-o test.i
(2) Compile (grammar check, convert C language into assembly language)
Example: Gcc-s test.i-o Test.s
(3) compilation (Translate assembly language into binary file)
Example: Gcc-c test.s-o TEST.O
(4) Link (link binary file to library)
Example: GCC test.o-o test
4. Compilation of multiple Program Files
Example: GCC test1.c test2.c-o test
5.GCC Common Instructions
-C: Just compile not connected, generate target file ". O"
-S: Just compile not assembler, generate assembly code
-E: precompiling only, no other processing
-G: Include standard debugging information in an executable program
-o File: Export output to File
-I dir: add dir directory to the search path list of header files
-static: Link Static Library
-I library: link Libraries file