Thread: Header Files

  1. #1
    Registered User
    Join Date
    Jun 2010

    Header Files

    i m new to C++ programming and using turbo c++ as an IDE.
    I m confused about some topics.
    . I m trying to define a class and its attributes in a header file and defining its functions
    in a .cpp extension file
    .do we have to compile our own header files?
    . I have also saved both the files in the same directory.
    . in compiling a header file i m getting error ( syntax error in class declaration).
    .my .cpp file gives no error in compilation but does not runs. i m getting
    messages such as "linking noname.exe"
    please help me out with this as i m not able to apply concepts in datastructures

  2. #2
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Post for us specifically what you are doing (including pertinent code), and in particular you errors and the lines to which they refer.

    Header files are included by source files (at least, that's the idea). You can then compile source files (which themselves contain the header files they include) into object files. For a given program, these object files will refer to each other. Then the linker resolves these references and creates an executable that does whatever you told it to, starting in main() in one of your source files.
    Header files let your code know what's out there and how to use it, while source files define what is out there.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  3. #3
    Join Date
    Oct 2007
    Inside my computer
    Drop Turbo C++ and get a real IDE first: Integrated Development Environment - cpwiki
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trying to make the best use of header files
    By alanb in forum C++ Programming
    Replies: 4
    Last Post: 08-31-2009, 04:45 PM
  2. what am I missing? (Program won't compile)
    By steals10304 in forum C Programming
    Replies: 3
    Last Post: 08-25-2009, 03:01 PM
  3. Header files and multiple definitions
    By sjweinberg in forum C++ Programming
    Replies: 16
    Last Post: 07-17-2009, 05:59 PM
  4. #include header files or .cpp files?
    By DoctorX in forum C++ Programming
    Replies: 3
    Last Post: 12-23-2006, 12:21 PM
  5. Request for comments
    By Prelude in forum A Brief History of
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM