The GCC or GNU Compiler Collection is a compiler and related auxiliary tools which are used to collect different programming languages into binary and related formats. GCC has been built and is currently provided by the GNU Project. GCC is very popular in the open-source community and used by many projects like the Linux Kernel. GCC has performed a very significant role in the first two decades of the open-source movement by giving free, open-source, and effective compiler collections.

 

What are the GCC Supported Programming Languages?

GCC is an open-source and adaptable compiler collection where it supports a wide range of programming languages like below.

> C Programming Language
> C++ Programming Language
> Objective-C Programming Language
> Objective-C++ Programming Language
> Fortran Programming Language
> Ada Programming Language
> Go Programming Language
> Java Programming language

 

What are the GCC Supported Hardware Platforms and Architectures?

Below are the GCC supported different hardware platforms and architectures like below.

Alpha
ARM
IA-32
IA-64
MIPS
PowerPC
SPARC
x86-64

GCC Usage

GCC can be installed into different operating systems like Linux, Ubuntu, Fedora, CentOS, Debian, Mint, Kali, Windows, macOS, etc. But the Linux programs are the most suitable platforms where GCC is mainly stated on Linux. GCC can be installed by using installers or package managers for the supported operating systems. GCC provides a command-line mode where many choices are given to define the compiling method details. Here you can get some basic usage cases about the GCC.


# Simply compile with GCC
$ gcc helloworld.c

# Compile into an executable file named hw
$ gcc helloworld.c -o hw

# Compile multiple files
$ gcc helloworld1.c myfile.c

# Show warning messages
$ gcc -Wall helloworld.c -o hw

 

Popular GCC Compiler Options

GCC is a feature-rich compiler toolset where different options are given for various cases. GCC benefits are used to change the default compile properties. Noted some of the popular GCC compiler options here.

-c option organizes source files into object files without linking.

-Dname=value provides preprocessor macro to the collection process.

-fPIC produces position-independent code for shared archives to be done by other binaries.

-glevel generates debug data into binary which can be debugged for errors with the gdb tool.

-llib links given lib or library into the created binaries.

Ldir look in given dir for library files to be used in compile process.

-o myexe sets the created executable file as myexe.

-Olevel optimizes the code and creates optimized executables and binaries.

-shared makes shared object files for shared library.

-w disables all warning messages.

-Wall allows all notification information.

-Wextra permits additional warning messages in a more involved manner.

 

Esta resposta lhe foi útil? 0 Usuários acharam útil (0 Votos)