Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

C++ compilation process

C++ compilation process

  • Identifiez-vous pour voir les commentaires

  • Soyez le premier à aimer ceci

C++ compilation process

  1. 1. C++ Compilation Process
  2. 2. Topics 1. Compilation Flow 2. Pre-processing 3. Compilation 4. Assembler 5. Linking (static or dynamic) 6. Questions ?
  3. 3. Program.cpp Pre-processing Program.ii Compilation Program.s Assembly Program.o Linking Executable or ELF
  4. 4. 1. Expansion of Macros 2. Define code as per macro condition 3. Remove Comments 4. Inclusion of all the Header files 5. Command to generate file after Pre-processor 6. Check Header files Guided Macros > g++ -E SourceFileName.cpp -o SourceFileName.ii
  5. 5. Compile the source code file using below command give output file shown as last lines in fig.2 g++ -E -D_WIN32 srcfile.cpp -o srcfile.ii
  6. 6. 1. Do syntax checking. All the compilation error w.r.t are caught here. 2. Code Optimization. 3. Generate Assembly Code. 4. Command to generate file after Compilation g++ -S SourceFileName.cpp –o SourceFileName.s
  7. 7. Compiler call the assembler to convert the assembly source file with ‘.s’ extension into object file. Command to generate object file after Assembler Operation g++ -C SourceFileName.cpp –o SourceFileName.o Command to view the ELF > objdump –x srcfile.o
  8. 8. Command to view the ELF > objdump –x srcfile.o
  9. 9. The compiler take all the required object file with ‘.o’ extension and covert it into single binary executable or ELF (Executable and Linking File with execution ‘.a’ or ‘.so’). Command to generate executable file after Linking Operation > g++ SourceFileName.cpp –o SourceFileName.out > g++ mainCode.o –L. -libSrcCode.a –o mainbin (dynamic library linking) > g++ mainSrc.o –L. -libSrcCode.so –o mainbin (static library linking)
  10. 10. Command to view the ELF > readelf –a execfile

×