Parts of the Compile Command Syntax

Raheelanjum
2 min read2 days ago

Compilers provide many options and settings that you can use depending on what properties you want the compiled program to have (e.g., faster vs. easier to debug).

Again, remember we use the following command to compile a program:

The options we will use for g++ are:

g++: (the name of the compiler)

-g : (allow debugging)

-pedantic : (only allow real C)

-Wall : (provide all warnings of possible mistakes)

-o "X" : name the exectuable X

file.C : the source code

there are many (MANY) more options, but few that we will use in CS1000. These have to do with optimizations, specific computer architectures, etc...

A Note on the G++ (GNU) Compiler

There are many compilers for C, but we will focus on a free open source version called the Gnu C compiler. (Actually we will use the Gnu C++ compiler, but all C programs compile using this compiler).

The g++ compiler is open source, meaning you can use it for free on any project you want, including "for profit" projects. Further, if you so desire, you could extend the compiler to work better, fix bugs in the compiler, port the compiler to another operating system/computer architecture, etc.

G++ will compile not only C++ programs, but C programs as well!

You can download G++ free of charge for your home machine. It will run under Linux or Windows. The most recent version of the compiler can be found here:

Additional documentation on the compiler is available at this location as well.

--

--

Raheelanjum
Raheelanjum

Written by Raheelanjum

Highly skilled and experienced content writer dedicated to crafting compelling, informative content that resonates with diverse audiences. Expertise spans blog

Responses (20)