Learn C++ Online

Compilation and execution in detail (part 1)

On this page
This lesson contains approximately 20 minutes of video content.

Nature of programming

Compilation pipeline

Preprocessor

Note: This lesson was developed when our development environment used an older version of clang++, i.e., clang++-10. When compiling in our environment, please use clang++: it is linked to the newest version of clang++ installed in the container.

Q1

QQ1

This question is ungraded.

Given the following program code:

#include "<iostream>";
#include "my-functions.hpp";

int main(int argc, char* argv[]) {
  std::cout << "Whoop!" << std::endl;
  return 0;
}
What does the preprocessor command #include "my-functions.hpp" do?

Q2

QQ2

This question is ungraded.

Given the following header file, utilities.hpp:

int multiply(int x,int y);
#endif
What's missing from the top of the file?

Q3

QQ3

This question is ungraded.

Study the diagram overviewing the C++ compilation pipeline presented in the Compilation pipeline video. Based upon this diagram, what is the output of the compiler?

Q4

QQ4

This question is ungraded.

Study the diagram overviewing the C++ compilation pipeline presented in the Compilation pipeline video. Based upon this diagram, what is the output of the assembler?

Q5

QQ5

This question is ungraded.

Study the diagram overviewing the C++ compilation pipeline presented in the Compilation pipeline video. Based upon this diagram, what is the output of the linker?

To be continued

We will continue our discussion on Compilation and Execution in the next lession!