Linux Basics Practice Test: GCC Compiler (Options & Stages of Compilation) — Flashcards | Linux | FatSkills

Linux Basics Practice Test: GCC Compiler (Options & Stages of Compilation) — Flashcards

Fast review mode: answers are shown by default so you can skim quickly. Hide them if you want to self-test.

The GNU Compiler Collection (GCC) is a free, open-source compiler system that supports many programming languages, including C, C++, Fortran, and Java. It comes standard with most versions of Linux and is the official partner of GNU OS. GCC is a key component of the GNU toolchain and the standard compiler for most projects related to GNU and Linux, including the Linux kernel. 

GCC is an essential tool for developers as it translates source code into an executable program that the machine can understand. It also provides options to help debug code, such as compiling code with debugging information.  GCC is available for Linux, Windows, various BSDs, and a wide assortment of other operating systems. 

Here are some ways to install GCC on Ubuntu:
Method 1: Update the Ubuntu package repository, then install the build-essential package
Method 2: Install multiple GCC versions on Ubuntu
Method 3: Install GCC compiler on Ubuntu from source 
For Red Hat Linux, Fedora, or CentOS based Linux operating systems, you have to install the Development Tools package to get the GCC compiler in your system. 

The Linux GCC compiler has four compilation stages: preprocessing, compilation, assembly, and linking. The syntax for the command is 

Here are some of the options in the GCC command:
-o:
Specifies the output file name
-Wall: Enables all compiler warning messages
-g: Enables debugging information 

Here are some details about each stage:
Preprocessing:
The first stage of compilation, which involves using a preprocessor to modify the source code before compilation. The preprocessor performs tasks like macro expansion, conditional compilation, and including header files.
Assembly: The assembly instructions generated during compilation are translated into object code, or machine code. The "as" software translates the assembly language to machine language.
Linking: The final stage of compilation, which links object files to produce the final executable file. An executable file requires many external resources, such as system functions and C run-time libraries. 

1 of 50 Ready
Which one of the following command creates the executable file a.out?
gcc fatskills.c
Shortcuts
Prev Space Show / hide Next
Turn this into a study set.
Sign in with Google to save tricky questions to your reminder list and resume on any device.
Sign in with Google Free • no extra password