resource file problem

This is a discussion on resource file problem within the Game Programming forums, part of the General Programming Boards category; Hey. Things are going along nicely. Well, they were. Learning menus now. I'm having problems with the .RC files. The ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    50

    resource file problem

    Hey. Things are going along nicely. Well, they were. Learning menus now.

    I'm having problems with the .RC files. The resource files that contain information on what is actually in the menus. Here is the code:

    Code:
    #include "resource.h"
    
    
    MYMENU1 MENU DISCARDABLE
    BEGIN
        POPUP "File"
        BEGIN
            MENUITEM "Open",                        ID_FILE_OPEN
            MENUITEM "Close",                       ID_FILE_CLOSE
            MENUITEM "Exit",                        ID_FILE_EXIT
        END
        POPUP "Help"
        BEGIN
            MENUITEM "About",                       ID_HELP_ABOUT
        END
    END
    
    
    .

    This the resource file for a simple windows program that has menus. One is "file" and one is "help". I can't get this to compile. I'm using MSVC 6.0. This is what it says:

    Compiling resources...
    C:\Program Files\Microsoft Visual Studio\MyProjects\Basic menu\Prog_2.rc(1) : fatal error RC1015: cannot open include file 'resource.h'.
    Error executing rc.exe.

    Prog_2.res - 1 error(s), 0 warning(s)



    I don't know where or what resource.h is. Is it a generated header file? Any help would be appreciated. I'd like to get this compiled, understand it and move on to better things.

  2. #2
    Registered User
    Join Date
    Mar 2004
    Posts
    27
    >Is it a generated header file?

    Yes, you can search your computer for it. Or, you could make your own.

  3. #3
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    on the left side just right click on header files and click on add files/folders. double click on your resource.h. Then your #include "resource.h" will work.

    but for a header file that short you should just copy and paste the code into your main cpp file.

  4. #4
    Registered User
    Join Date
    Mar 2004
    Posts
    50
    thanks guys.

    I got it!! I can't believe I figured it out but I did. I know it probably seems simple to you guys but its been about 6 years since I had a programming class and really don't remember much of it.

    Here is the resource.h file that I needed:

    Had to write it myself but being only about 6 lines it was easy. I am trying to follow along in this book but it seems the guy left out the damn resource.h file in the instructional cd.

    Code:
    // resource.h with menu ids
    
    #define ID_FILE_OPEN      1000
    #define ID_FILE_CLOSE     1001
    #define ID_FILE_EXIT      1002
    #define ID_HELP_ABOUT     2000
    bool eof();
    Also, I don't know what happened but the guy had another variable misspelled in another header so when it compiled, it worked but didn't have any menus, just a window. Maybe he did it on purpose so I'd have to sort it out.

  5. #5
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    nice. but i thought the problem you had was not being able to find resource.h?

  6. #6
    Registered User
    Join Date
    Mar 2004
    Posts
    50
    being new, I thought maybe the author was refering to a header already in MSVC , but I did search of my MSVC folder and found nothing.

    I don't know if I was supposed to write it or what. Is it possible that MSVC will generate a header for you?

    That was way more complicated than it needed to be. The author just wants me to learn about resource files and things to make it more organized for when I get into bigger programs I guess.

  7. #7
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    yes, msvc generates a resource.h file for you, provided you use it's import/create new resource feature. once you save it as a .rc, it automatically spits out a resource.h that corresponds with that specific rc(resource file)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM
  5. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM

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