Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Compilation of a header file in c++

  1. May 28, 2009 #1
    Hi..am just learning c++...i have a doubt..

    Suppose you have a header file and you include it in your main program by using the #include directive..then do you have to compile the header file separately? Or does it get compiled with the main program?
     
  2. jcsd
  3. May 28, 2009 #2

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    Yes, all the #include does is copy the text of the header file into the .cpp file before passing it to the compiler
     
  4. May 28, 2009 #3
    I guess your yes means that one does not have to compile a header file separately...and it gets compiled with the main program..?
     
  5. May 28, 2009 #4
    I understand..thank you..
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Compilation of a header file in c++
Loading...