Thread: Understanding Headers

  1. #1
    Registered User
    Join Date
    Jun 2007

    Understanding Headers

    I'm currently in the process of learning c++ and I am trying to get a better understanding of whats going on... I was wondering if it is possible to program anything useful without using headers, and also... what is inside these headers, i have a vague understanding but its still doesn't quite all add up yet.

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Well the headers just contain prototypes and constants and the like, if you really want to see what the stuff in the header does how it does it, go take a peak at the GCC runtime library source.

  3. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Northern Virginia/Washington DC Metropolitan Area
    Open one up and take a peek. They're just text files with a different (or no) extension. They mostly contain function prototypes, #define statements, struct/class declarations and in the case of templates (usually) actual code. This information is primarily needed by the compiler to perform it's job of type checking. An #include statement for a given header informs the compiler to take the contents of that file and dump it into the source file (copy and paste basically) during the preprocessing stages and prior to the actual compilation step.
    Last edited by hk_mp5kpdw; 06-27-2007 at 05:55 AM.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help understanding Headers and Other beginner stuff
    By Saintdog in forum C++ Programming
    Replies: 3
    Last Post: 12-01-2004, 09:34 PM
  2. Understanding Headers and Inclusions
    By jdm in forum C++ Programming
    Replies: 11
    Last Post: 04-21-2004, 10:11 PM
  3. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 03:49 AM
  4. Headers that use each other
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 10-03-2003, 04:25 AM
  5. how do you handle all your headers?
    By mart_man00 in forum Linux Programming
    Replies: 0
    Last Post: 06-16-2003, 03:17 PM