Thread: Header Files

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    19

    Question Header Files

    I finished a project and a got a 48/50 on it but the points I lost where due to it being one day late and not making a header file. So now I am going back and trying to make a header file (for self satisfaction) and my question is how do I make and complie a header file with the program.... here is what I tried:

    I took the things my teacher wanted in the header, and placed them in a new file (hangman.h). This is what the file looks like:

    Code:
    #include<stdio.h>
    #include<stdlib.h>
    #include<string.h>
    #include<ctype.h>
    
    void menu(int *option);
    void players(int *player);
    void playGame(char word[], char list[][32], int player, int count, char usedWord
    s[]);
    void getList(char word[], char list[][32], int *count);
    void getWord(char word[], char list[][32], char usedWords[], int count);
    void enterWord(char word[]);
    void guessWord(char word[]);
    void drawMan(int numWrong);
    void listWrong(char wrongLetters[], int i, char guess);
    void listText(char wrongLetters[], int numWrong, char guess, char blanks[]);
    I then placed
    Code:
    #include<hangman.h>
    at the begining of my hangman.c file.

    I tried a few different complies but it didn't seem to work right.

    So how should I complie it? And is there a way to complie the header once, so you don't have to recomplie it? (So if you wanted to reuse the header, no extra compile time).

    (I believe my teacher said .:gcc project.c header.o -o project:. would add header.o to project.c and complie project.c. But how do you get header.h to header.o O o. Of course I could be a complete idiot and be way off... so if you aren't sure what I am talking about, but get the idea I don't either, let me know XD)

    (I have a class in ten minutes, and then work till three or four. So if I don't reply right away, I apologize ^^; )
    Last edited by Volair; 12-09-2005 at 10:36 AM.

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