header files

Discussion in 'C' started by markyjj, Dec 11, 2005.

  1. markyjj

    markyjj New Member

    Joined:
    Dec 7, 2005
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    Can anybody help with the following subject please

    Ive made a program in C++ and stated that there is a header file (headerfile.h)to be used. However, when I compile the program a message appears saying that it is unable to include the header file.

    Im not sure where I actually define the header file. Can this be defined in notepad or a directory within the program or within the same directory as Microsoft Visual Studio, the software that am using?

    Any help would be very much appreciated...thanks
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    This error comes up when the compiler cannot find the header file in the current folder or in the specific folder specified. Make sure the header file exist in the same folder as the cpp file and use the following syntax.

    Code:
    #include "headerfile.h"
    Its not necessary to have the header file in the same folder but its a good practice. If its not there in the same folder use the relative path to tell the compiler where it can find the header file.

    Thanks
    Shabbir Bhimani
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice