Need help with solving this compiler error

I am trying to make a .rc (run command) file so that i can make a windows menu for my word processor application, but the compiler keeps giving me this error "expected unqualified ID before numeric constant"


Here is my .rc file..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#define ID_Menu 100
#define ID_Save 0
#define ID_Open 1
#define ID_SaveAs 2

ID_Menu MENU DISCARDABLE   //COMPILER ERROR
{
    POPUP "File"
        {
           MENUITEM "Save", ID_Save
           MENUITEM "Open", ID_Open
           MENUITEM "Save As", ID_SaveAs
        }

};



Ok so I know that an unqualified ID is some sort of object/variable that does NOT have an indication to where it belongs, and the numeric constant is the ID_Menu.. So what should i put before the numeric constant to make this work?
Last edited on
you do the #defines in your header file.
I have already tried moving the #defines to it's own header file but it still won't work.


here is the header file.
1
2
3
4
5
6
//resource.h

#define ID_Menu 100             /* The Menu Identifier */
#define ID_Save 0               /* The menu item identifiers */
#define ID_Open 1
#define ID_SaveAs 2 




and here is the .rc file
1
2
3
4
5
6
7
8
9
10
11
12
#include "resource.h"

ID_Menu MENU DISCARDABLE       //error is still here
{
    POPUP "File"
        {
           MENUITEM "Save", ID_Save
           MENUITEM "Open", ID_Open
           MENUITEM "Save As", ID_SaveAs
        }

};


I still get the same compiler error " expected unqualified ID before numeric constance"
Last edited on
Haven't been creating win32 resources manually for a long time. I just created one in Visual Studio, and it gives the following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#define IDC_MENU 100
#define IDM_ABOUT 101
#define IDM_EXIT 102

IDC_MENU MENU
BEGIN
    POPUP "File"
    BEGIN
        MENUITEM "Exit", IDM_EXIT
    END
    POPUP "Help"
    BEGIN
        MENUITEM "About", IDM_ABOUT
    END
END
I am still getting the same compiler error.. I have tried adding the BEGIN and END. I have also tried removing the brackets to see if it would make a difference. But the compiler keeps giving this error "expected unqualified ID before numeric constant"

Can anyone help me?
Nevermind, i figured it out.

It turns out that i wasn't supposed to include the .rc file in the c++ source code file.
Topic archived. No new replies allowed.