Learn C++ in one evening with this brief yet straight to the point tutorial.
We divided the repository is sections starting from 00_hello_world
. Each of the sections will teach you gradually the syntax of C++, from zero to (almost) hero. Drop a ⭐️ if you found it helpful!.
Choose and install your favorite C++ compiler (I will use g++). If you wish to learn how to compile your code visit this links if you are a Window, Linux or MacOS user. Then compile and execute the output binaries, here's what I do to run the first hello world
example:
cd 01-hello-world
g++ 00_hello_world.cpp
Finally, we can execute the binary as:
./a.out
According to this helpful resource, the compiler goes through the following 5 steps:
- Pre-processing: First, the pre-processor reads the source code and performs macro expansions, inclusion of header files, and other operations as specified by pre-processor directives (#include, #define, #ifndef, etc.).
- Compilation: Second step performs the actual translation of the source code into object code. The object code is a machine-readable representation of the source code, but it is not yet executable.
- Assembly: The compiler then passes the object code to an assembler, which converts the object code into assembly code.
- Linking: The linker then combines assembly code with any library functions that are required by the program and resolves any references to external symbols/libraries. The linker produces an executable file to run on the target platform.
- Execution: Finally, the compiler produces and executable file that runs on the computer system.