How do you Load a Header file?

This is a discussion on How do you Load a Header file? within the C Programming forums, part of the General Programming Boards category; I want to load a header file I made.......but i dont know how to call it or interpret it in ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    31

    How do you Load a Header file?

    I want to load a header file I made.......but i dont know how to call it or interpret it in anyway. for example.

    #include <windows.h> //windows main files
    #include <gl/gl.h> //OpenGL main file
    #include <gl/glu.h> //OpenGL library kit main files
    #include "Loader.h" //Loads Bitmap Files

    thats the problem I dont know how to call it so it can be used to load the Bitmap files and convert it to textures.
    - Read to Learn, and Learn to Read -

  2. #2
    Nit
    Nit is offline
    Registered User
    Join Date
    Mar 2002
    Posts
    42
    #include "Loader.h"

    This statement is correct and any code that you wrote within that header file will be entered into your code during the preprocessor stage.

    But, if that's not what you mean, then please explain a little more clearly - I'm a tad confused.
    http://www.KBeutler.com

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    31

    Unhappy ......Not sure buddy

    Like ok when you create a Header file and you want it to be compiled at a certain Line of the codes. for example.

    01 printf(" Hellow world ");
    05 ......right here you want to caLL the header file
    10getchar();

    So do you get what Im saying now
    - Read to Learn, and Learn to Read -

  4. #4
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    523
    05 ......right here you want to caLL the header file
    You can't call the header file, you include it.
    If you mean call a function thats defined in your header file then you can call that function wherever.
    Code:
    #include "Loader.h"
    
    int main( void )
    {
         // do stuff
    
         Load_Bitmap();  // function defined in Loader.h
    
         // do more stuff
    
         return 0;
    }
    All spelling mistakes, syntatical errors and stupid comments are intentional.

  5. #5
    Nit
    Nit is offline
    Registered User
    Join Date
    Mar 2002
    Posts
    42
    I'm still lost. Ugh.

    Let's say your header file has this inside of it.

    myHeader.h
    #define maxline 1024
    #define minline 10

    myProg1.c
    #include "myHeader.h"
    ... code ...

    myProg.c is now (after the include):
    #define maxline 1024
    #define minline 10
    ... code ...

    All that the include statement does is text insertion. If you want a certain function to be called at some arbitrary place in your code then write a seperate file (myOtherFile.c) with all of your functions and include it.

    #include "myOtherFile.c"

    Header file generally contain only constants, ifdef statments, etc..
    http://www.KBeutler.com

  6. #6
    Registered User
    Join Date
    Mar 2002
    Posts
    31

    Talking I see what you mean

    Oh I understand now, your saying I can call a funtion thats in the Loader.h file. At any time I want to in the code.
    Ok so now its making sense to me thanks man.
    - Read to Learn, and Learn to Read -

  7. #7
    Registered User lliero's Avatar
    Join Date
    Oct 2001
    Posts
    59

    Talking another one

    you must compile your functions into object file, then put them into library, then make a header file that is function declarations
    then you can say include <bitmap.h> assuming you save your
    objects and header file with the standard c headers altogether

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  2. Class methods in header or source file?
    By TriKri in forum C++ Programming
    Replies: 13
    Last Post: 09-17-2007, 05:23 AM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM

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