Thread: #define Header files. End Of File Errors.

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    76

    #define Header files. End Of File Errors.

    Hi to be honest im a C++ programmer but I needed to do this bit in C and it confused me. I created a resource file for my project with integer_ids. Which need to be defined in a seperate header file.
    So I create the header file full of define statements like these
    Code:
    #define ID_ICON1	100
    #define ID_ICON2	101
    #define ID_Cursor1	102
    #define ID_Cursor2	103
    Then when it comes to compile it the resource compiler jsut states that there is an unexpected End of File in the header file and fails.

  2. #2
    Registered User
    Join Date
    Jul 2003
    Posts
    26

    Post

    This may have no relevance, but did you have an

    #ifndef

    ...

    #endif

    Or some sort of unclosed statement?
    "Borland Rocks!"

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Are you trying to compiler the header file? (you shouldn't be)
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    Registered User
    Join Date
    Feb 2003
    Posts
    76
    I didn't think you had to have a #ifndef an #endif statement. All im doing is having a header file full of definitions.

    No im trying to compile the header file mate. I have an #include statement in my resource file refering to it.

  5. #5
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    >I didn't think you had to have a #ifndef an #endif statement.

    You don't. But having an #if ... #endif without the closing #endif, or a start of comment /* without its closing */ are two ways to produce this kind of error.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    26

    Post

    Yes
    "Borland Rocks!"

  7. #7
    Registered User
    Join Date
    Feb 2003
    Posts
    76
    I don't use #ifndef or #ifdef. All it is, is a header file with a few define statements. So you know exactly what I mean I will attach my project file, so you can see if you can get it to work.

  8. #8
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Would this be the error?
    Compiling resources...
    C:\Test\id\RESOURCE.H(2) : fatal error RC1004: unexpected end of file found
    If so, I found this link relatively quickly with a search. It states the following.
    Possible cause
    Missing linefeed and carriage return characters on the last line of a text file.
    And I did find this to be true of the file "resource.h" -- it did not end with a newline.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  9. #9
    Registered User
    Join Date
    Feb 2003
    Posts
    76
    Thanks mate. I owe you one. That must me one of the stupidest errors I have ever heard of, but it looks like it worked. I was so close to throwing my computer out of the window.
    Many thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help me with function call
    By NeMewSys in forum C++ Programming
    Replies: 16
    Last Post: 05-22-2008, 01:53 PM
  2. Need help understanding Header Files
    By Kaidao in forum C++ Programming
    Replies: 11
    Last Post: 03-25-2008, 10:02 AM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM
  5. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM