Own Header Files

This is a discussion on Own Header Files within the C++ Programming forums, part of the General Programming Boards category; ((Sorry, if smth like this was posted, but I didn't find anything with search-sorry and for bad English)) Plz don't ...

  1. #1
    Aco
    Aco is offline
    Registered User
    Join Date
    Oct 2003
    Posts
    2

    Unhappy Own Header Files

    ((Sorry, if smth like this was posted, but I didn't find anything with search-sorry and for bad English))
    Plz don't think I'm a total noob, because I asked this questions:
    1.
    I created my own header file which includes my functions for a new game. I saved it in a "include" file of C++(where are the iostream, stdlib etc.). Now my problem is that I don't know how to use it if it's not in that file. This really a problem for me, but if I'd create a lots of .h/.hpp files, thre will be a total mess .
    2.
    Which is better for C++: .h or .hpp files?

  2. #2
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    It is normal to create dozens of header files for a big project.

    If you do not wish to copy your header files to a new project directory each time you start a new project, just put them in your compiler's default include directory.

    Whether .h or .hpp is used is often decided by which compiler you're using. I use .h.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    > just put them in your compiler's default include directory.
    No, don't do that - not unless you like losing all your work when you upgrade / patch / change your compiler.

    Create separate 'myinc' and 'mylib' directories for all the useful stuff you create and want to re-use from project to project.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. #include header files or .cpp files?
    By DoctorX in forum C++ Programming
    Replies: 3
    Last Post: 12-23-2006, 11:21 AM
  3. classes and header files
    By Drake in forum C++ Programming
    Replies: 8
    Last Post: 11-30-2006, 06:12 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21