Demonstrate that we can compile programs by hand.
Being able to compile code manually is important as it demonstrates that you understand what the process is, the steps that go into creating an executable and how the various files interact.
Without this knowledge you will find it difficult to solve compiler issues in the future when you are using IDEs or build systems instead of manually compiling as you will not know what is supposed to be happening and so will not be able to identify which part has gone wrong.
Compile the **main.cpp** file into an executable called **byhand** using the 3 separate compile commands needed. Details are in the lecture slides. Compiling by hand
- We need to compile the main.cpp file
- Because our program uses the code in the print_two .h and .cpp files we also need to compile print_two.cpp.
- print_two.h is automatically included thanks to the
#include
lines in our code.
- print_two.h is automatically included thanks to the
- Finally we need to link together those two object files to produce the final executable file that we are going to call byhand.
This executable should be placed in the bin/ directory.
{Check It!|assessment}(test-2677297096)