0

why we need header files instead of just define things in library files ?


I'm asking this question because I recently read an article like this:

While it is true that all definitions are declarations the converse is not true: all declarations are not definitions.

Pyro Soft
  • 3
  • 2
  • 3
    Does this answer your question? [Why have header files and .cpp files?](https://stackoverflow.com/questions/333889/why-have-header-files-and-cpp-files) – Geno C Aug 28 '20 at 18:20
  • 1
    In C++ libraries are linked after compilation. – QuentinUK Aug 28 '20 at 18:22
  • @QuentinUK i guess its the answer for my question thanks :) – Pyro Soft Aug 28 '20 at 18:31
  • There is no need for header files. You need function declarations and variable declarations to help the compiler. You can copy the declarations from one source file and place them into another. – Thomas Matthews Aug 28 '20 at 20:21

0 Answers0