Thread: header files

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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, 12:21 PM
  3. classes and header files
    By Drake in forum C++ Programming
    Replies: 8
    Last Post: 11-30-2006, 07:12 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM