Jump to content

  • Log In with Google      Sign In   
  • Create Account

Help me understand .cpp vs .h in C++


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
20 replies to this topic

#21 JohnnyCode   Members   -  Reputation: 329

Like
-1Likes
Like

Posted 27 March 2013 - 09:54 PM

Compiler compiles only cpp files . Cpp and h file should be in one file, but the need to have them separate caused for #include directive, so you simply put them to file you need to compile (literaly). The reason to separatet them is, that other projects may need to use your library, but would like to do so without compiling your library, so they just put your h. files to their cpp files and compile them, and on runtime your library internal routine is run. When you will code modules/libraries/projects, whatever is the termine, you will understand also obstacles this design brings.



Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS