compiling header file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rampraveen
    New Member
    • Apr 2010
    • 37

    compiling header file

    hai guys..just now before i download one header file for c.but i do't know how to use that,..tat header file is needed for another compiling of program....any body know pls tell.(in windows XP)
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Header files contain declarations that may be needed in more than one implementation file (.c or .cpp). Rather than hard-code the declaration in every file, they are put in a header file.

    Header files are just text files. By tradition, in C they have a .h extension and in C++ they have no extension. However, this is optional and not checked by the proprocessor.

    Just:

    #include <MyHeader.h>

    or

    #include "MyHeader.h "


    The <> format says the header file is located along a predefined path. Known as "the usual places". You define these paths by going to your project's properties and looking at the ones for the preprocessor. One of thise properties is "additional include directories".

    The " " format says the header file is located in the same folder as the implementation file. If it's not, then the usual places are searched sames is if you had used the <> format.

    Comment

    • donbock
      Recognized Expert Top Contributor
      • Mar 2008
      • 2427

      #3
      Originally posted by rampraveen
      ... tat header file is needed for another execution of program ...
      Header files are not needed to execute a program; they are only needed to compile a program.

      Comment

      • rampraveen
        New Member
        • Apr 2010
        • 37

        #4
        k.but to compile that header file is need.when i execute that program it wants that header fille.how can i use the new header file..pls tell

        Comment

        • rampraveen
          New Member
          • Apr 2010
          • 37

          #5
          k.how can i use the new header file.......tat' s my doubt..

          Comment

          • weaknessforcats
            Recognized Expert Expert
            • Mar 2007
            • 9214

            #6
            What is the "new header file"? Is is different from the on eyou started with?

            Comment

            • donbock
              Recognized Expert Top Contributor
              • Mar 2008
              • 2427

              #7
              Originally posted by rampraveen
              k.but to compile that header file is need.when i execute that program it wants that header fille.how can i use the new header file..pls tell
              Please clarify ... do you get an error when you compile (build) your program or when you execute it? You keep saying the problem occurs when you execute your program, but that doesn't make any sense if we're talking about C preprocessor header files. Perhaps we're talking about something else.

              Comment

              • jkmyoung
                Recognized Expert Top Contributor
                • Mar 2006
                • 2057

                #8
                The header file you compiled basically tells the compiler -> "I'm going to be using these classes and functions. Don't worry about it now; I'll provide them later".

                When you run the program, the program now says "Where is the compiled code for these classes and functions you told me about?"

                You probably need to provide the compiled object code .o, for these headers that you used, when you are running your file.

                Comment

                Working...