header files

This is a discussion on header files within the C Programming forums, part of the General Programming Boards category; can anyone let me know if i need to compile a header file that i have written myself...

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    8
    can anyone let me know if i need to compile a header file that i have written myself

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,447
    I've split this from your previous question since it was off-topic bump.

    You don't compile header files as such, you include them in other source files (which are then compiled).

    func.h - tells other source files what goodies exist in func.c
    func.c - contains all the details

    main.c would have
    Code:
    #include "func.h"
    Finally, to build everything, you would do
    Code:
    gcc main.c func.c

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