CS 70

Before You Start

What is the difference between a header file (.hpp) and a source file (.cpp)?

Here's the key idea:

  • A source file (.cpp) contains the definitions of functions (the actual code that implements them).
    • Source files need to be compiled (into object files .o).
  • A header file (.hpp) contains forward declarations.
    • Header files do not need to be compiled.
    • They have their content #included into source files.
  • Duck speaking

    And what about object files?

  • LHS Cow speaking

    Object files need to be linked together to create an executable.

(When logged in, completion status appears here.)