Thread: Header Files / Including

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User FlamingAhura's Avatar
    Join Date
    May 2010
    Posts
    5

    Header Files / Including

    Hey everyone, I'm hoping you can help me with a simple question I've never been able to find a clear answer for.

    Basically, let's just assume I'm making a program and have the following files:
    Code:
    a.h - defines/prototypes/typedefs for code in a.c
    a.c - code
    
    b.h - defines/prototypes/typedefs for b.c
    b.c - code
    
    common.h - defines and typedefs used in all code files
    
    main.c - main() / other code
    1. Does this make sense?
    2. Assuming I have include guards and am compiling this into a single executable, where should my includes be? For example, I feel that I need to "#include a.h" in a.c, but what about "#include a.h" in main.c if I'm calling the functions there? And where should I include common.h?
    Last edited by FlamingAhura; 11-03-2010 at 08:46 PM.

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. C Header Files
    By devarishi in forum C Programming
    Replies: 8
    Last Post: 12-10-2008, 04:53 PM
  3. Including header files
    By Emeighty in forum C++ Programming
    Replies: 5
    Last Post: 08-09-2008, 03:02 PM
  4. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM

Tags for this Thread