Saturday, May 2, 2015

C language from BaseBand Processor Eng perspective 10 : Usage of GCC compiler

C building works in below stage 

Preprocessing :  At this stage, all the preprocessor will be included in the code file

     To only preprocess a file  >  gcc  -E hello.c  -o hello.i

 Compilation : Code will be changed to assembly code

     To see assembly code    > gcc -S  hello.i  -o  hello.s

 Assembly : assembly  code to executable code

   >  gcc -C  hello.s   -o  hello.o

Linking : This will link all the libs and code and generate output/exe file

 > gcc -o output hello.o


To have more than one file linked

gcc -o  output  file1.o file2.o file3.o


To generate executable in one shot

gcc -o output file.c


No comments:

Post a Comment