We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,140 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

WinAPI compile error

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

2
Contributors
4
Replies
19 Hours
Discussion Span
5 Months Ago
Last Updated
5
Views
mattster
Junior Poster
126 posts since Nov 2012
Reputation Points: 9
Solved Threads: 9
Skill Endorsements: 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.

Ancient Dragon
Achieved Level 70
Team Colleague
32,128 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,575
Skill Endorsements: 69

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

mattster
Junior Poster
126 posts since Nov 2012
Reputation Points: 9
Solved Threads: 9
Skill Endorsements: 0

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
Ancient Dragon
Achieved Level 70
Team Colleague
32,128 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,575
Skill Endorsements: 69

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

mattster
Junior Poster
126 posts since Nov 2012
Reputation Points: 9
Solved Threads: 9
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0655 seconds using 2.67MB