1.11M Members

WinAPI compile error

 
0
 

Hi all,

Am building a WinAPI project in Code::blocks and MinGW. I Downloaded some opensource source code, and tried to compile the snippet haveing done nothing to it, and I get Syntax Error on line 6 for the following code:

IDR_MENU MENU DISCARDABLE
{//BEGIN

    POPUP "File"
        {//BEGIN
            MENUITEM "New",                        IDM_NEW
            MENUITEM "Open",                       IDM_OPEN
            MENUITEM "Save",                       IDM_SAVE
            MENUITEM SEPARATOR
            MENUITEM "Exit",                       IDM_EXIT
        }//END
    POPUP "&Options"
        {//BEGIN
            MENUITEM "&Show Toolbar",               ID_OPTIONS_SHOWTOOLBAR
            , CHECKED
        }//END
}//END

If needed I could try to find the link to the entire program source I've downloaded. What stumps me as that I have done nothing to the code yet :S

Thanks for all of your help,
Mattster

 
0
 

You have to compile that with a resource compiler, not a c++ compiler. What filename did you give that code? It needs to have .rc extension.

 
0
 

yes, it is named english.rc, do I need to do something seperately then as I was under the impression Code::blocks did it automatically?

Thanks Ancient Dragon

 
1
 

The problem is that all those macris the rc file are not defined. Create a file named english.h and define them there. It doesn't matter what numbers you assign to them as long as there are no duplicates.

// english.h
#define IDM_NEW 1
#define IDM_OPEN 2
#define IDM_SAVE 3
#define IDM_EXIT 100
#define ID_OPTIONS_SHOWTOOLBAR 500

Then include english.h at the top of english.rc

#include "resource.h"
IDR_MENU MENU DISCARDABLE
{//BEGIN

    POPUP "File"
// rest of the rc file goes here
 
0
 

Thanks Ancient Dragon, worked like a breeze!!
Now to deal with the next set of errors lol ;)

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: