- [Instructor] C++ is a compiled language.
This means that your development cycle
will include a distinct compilation step.
If you're already familiar with a scripting language
like JavaScript, Python, Perl, or PHP
this may be a new experience for you.
Languages like JavaScript, Python, Perl and PHP
are effectively interpreted languages.
This means that your entire toolchain consists of an editor
and the language interpreter.
Your development cycle is simple,
you edit the source code and you run it.
Then to make a change or continue developing
you repeat the cycle, edit, run, edit, run, edit, run.
C++ is a compiled language.
This means that before you can run the code
it must be converted from source code
into something that your operating system can run.
For most of us, this happens
in an integrated development environment,
like an IDE, like Xcode or Visual Studio,
but it's still important to understand
what all the steps are.
The first step is the preprocessor.
The preprocessor is responsible for expanding macros,
providing conditional compilation
and combining source files with included header files
into a single file for the compiler.
The output from the preprocessor is usually a larger file
of source code called a translation unit.
The compiler takes the source code
from each translation unit and translates it
into object code.
This object code includes a symbol table
that allows it to link with code in other object files,
including libraries.
The object file from the compiler is not yet executable
by the operating system.
A linker takes one or more object files,
resolves all of their interdependencies and combines them
into something the operating system can run.
This allows you to use external libraries
even when you don't have the source code
from those libraries.
The output from the linker is an executable
that can run in your operating system,
and now you can run your code
and continue the development cycle as necessary.
In most cases, especially when you're using an IDE
like Xcode or Visual Studio, all of these steps,
preprocessor, compiler and linker
are automated by one command.
This combined set of actions is often collectively
referred to as compiling.
And even when considered as a unit,
each of these functions is performed as a separate step
and each step is a vital part of the process.
This may all seem like a lot of unnecessary detail
and it's okay if you don't commit it all to memory.
As we get into the details of C++
you'll get a better understanding
of how this knowledge impacts your coding.