When are the definitions present in different scenarios? [duplicate]

  c++, compilation, definition, linker, module

is this correct?

  1. For both user-made and library files, the files importing/including the header files only get the definitions during the linking process

  2. if one directly imports/includes some cpp file, the definitions are there during the compilation (I know this causes bloating and should be avoided)

  3. for modules, I am guessing whatever technique is used to only compile the interface once is also used on the definition/cpp file allowing for both to be present during compilation.

I am most unsure about the module one.

Also I put import/include since import can replace #include, and there shouldn’t be a difference if the file was made for #include.

Source: Windows Questions C++

LEAVE A COMMENT