What does this part of a main.cpp file do?
#include "library.h"
It causes the toolchain to compile all the contents of library.h so that its executable code is available when needed by the final application.
It causes the replacement of the #include directive by the entire contents of the source file library.h. This is similar to a Copy-Paste operation of library.h into main.cpp.
#include
It informs the linker that some functions or data used in the source file main.cpp are contained in library.h, so that they can be called in run time. This is also known as dynamic linking.
It cherry picks library.h for the declarations and definitions of all data and functions used in the remainder of the source file main.cpp, finally replacing the #include directive by those declarations and definitions.