Thread: Includes... which one? How does one decide?

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    31

    Includes... which one? How does one decide?

    Man, I hate being a newb...

    I've been reading a lot of the tutorials/comments from this site. How does one know which include file to use?

    For instance, I've been particularly interested in file access. I've seen several include files mentioned, but they are not all always required.
    How does one know which include to include? And, after you include it, how do you know what functions that exposes to you?

    Is there some great C++ archive that lists the include files, what they're used for and what functions they encapsulate?

    .. oh, and before you tell me to read the help files, I don't have them. I use Visual Studio 6 and... Microsoft, in their infinite wisdom... decided to make us purchase them separately (MSDN CDs) of which I can not afford at the moment.

    (...at least when I get lonely, I can always count on pressing F1 and getting the message <DING!> "Please install the MSDN Library")
    Welcome to the funhouse, where strange mirrors reflect the faces of insanity.

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    I've been reading a lot of the tutorials/comments from this site. How does one know which include file to use?
    1. One takes a look in his/her textbook and looks up which header file is required for a certain function.
    2. One consults a online reference like http://www.f.kth.se/~f95-pax/refs/C%20Library%20Ref/ to find out which header file is required.
    3. One asks, for example on boards like these, which header file is required.
    4. Experience.

    Microsofts MSDN is available online, thought the URL was msdn.microsoft.com.

  3. #3
    Unregistered
    Guest
    There is no master list of header files that can be included in a program. Down the road you will be creating your own custom files tailored for a given class, function, task, whatever.

    There ARE some standard files, like iostream, stdio, stdlib, time, math, iomanip, ctype, etc. that all compilers are like to have. There are some newer standard files like vector, queue, set, map, associated with the standard template library that the newest, up to date, state of the art compilers should have (these compilers tend to have all the old standard files as well but they are frequently renamed). Then there are some common, but non-standard files, the one that comes to mind being conio.

    What's in each of the files can be learned as previously suggested. If you aren't intimindated you can look at the function and class declarations contained in the files by opening them in your compiler or a text viewer-----just DON'T change anything you find there! I don't suggest doing this until you have a little more experience under your belt, but later on you'll be able to explore without the help files pretty well.

    Good luck!

  4. #4
    Registered User
    Join Date
    Jun 2002
    Posts
    31
    Thank you both.

    I guess I'm a little impatient. I've been programming in Visual Basic for a few years that most of it comes second nature (I know, I know... some C programmers don't recognize it as legit.)

    One of the problems is I have no resources for C++ (I have a link to this board and another site I found in one of the posts here). Unlike VB where I have an entire drive full of links, tutorials, source code... and tons of books.

    I just hate "starting over" - but I know it's going to take time...

    Is there a function or an #include for patience ?
    Welcome to the funhouse, where strange mirrors reflect the faces of insanity.

  5. #5
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >Unlike VB where I have an entire drive full of links, tutorials,
    >source code... and tons of books.

    There are free books on C++, like the one of Bruce Eckel his Thinking in C++. Which can be downloaded from:

    http://www.codecuts.com/mainpage.asp?WebPageID=315

    A very good, is ofcourse Bjarne Stroustrup his The C++ Programming Language. And there are more.

    >I guess I'm a little impatient.

    Well, then remember:

  6. #6
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    Open the .h file you think you need to include, and see what the functions inside do.

  7. #7
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    Usually the functions themselves are not implemented in the header files, but they are stored into libraries. You use the header-files to make the functions, and some other things like constants, known in your program.

  8. #8
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    I know the functions are not implemented in the .h file. But you can ususally tell what they do by their name and parameters

  9. #9
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    That is correct. But to know the behaviour of the function it is not enough. Example, if it returns an integer, what does that integer tell? And what about restrictions on input parameters? For this you would need a reference in which the functions are described.

  10. #10
    Registered User
    Join Date
    Dec 2001
    Posts
    194
    http://www.cplusplus.com/
    I use c++.com it is a nice reference site.
    There is also google. Searching for a function will usually turn up alot of information.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Includes making me insane >.<
    By IceDane in forum C Programming
    Replies: 14
    Last Post: 04-14-2008, 10:24 AM
  2. Makefile and includes
    By Lang in forum C Programming
    Replies: 4
    Last Post: 03-18-2008, 03:29 AM
  3. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  4. Why are using declarations passed over but not includes
    By indigo0086 in forum C++ Programming
    Replies: 7
    Last Post: 12-18-2006, 11:54 AM
  5. #includes
    By RedLenses in forum C++ Programming
    Replies: 3
    Last Post: 01-02-2002, 03:59 PM