Thread: Menu

  1. #1
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312

    Menu

    I used the tutorial of Winprog.org to create a menu, everything is the same, and it says:

    resources.rc:3: parse error before numeric constant
    This is resources.rc:

    Code:
    #include "resource.h"
    
    IDR_MYMENU MENU
    BEGIN
        POPUP "&File"
        BEGIN
            MENUITEM "E&xit", ID_FILE_EXIT
        END
    
        POPUP "&Stuff"
        BEGIN
            MENUITEM "&Go", ID_STUFF_GO
            MENUITEM "G&o somewhere else", 0, GRAYED
        END
    END
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

  2. #2
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Post your "resource.h" file.

  3. #3
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312
    Code:
    #define IDR_MYMENU 101
    
    #define ID_FILE_EXIT 9001
    #define ID_STUFF_GO 9002
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

  4. #4
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    In you'r main file, try changing:
    Code:
    wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU);
    Into:
    Code:
    wc.lpszMenuName = "MAIN";
    And In your resource file:
    Code:
    IDR_MYMENU MENU
    Into:
    Code:
    MAIN MENU

  5. #5
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Quote Originally Posted by Ideswa
    I used the tutorial of Winprog.org to create a menu, everything is the same, and it says:
    Quote Originally Posted by windres
    resources.rc:3: parse error before numeric constant
    The reason for the error is that windres, the resource compiler, doesn't recognise the MENU resource definition statement. You need to #include <windows.h> in resources.rc or, better, #include <afxres.h> for better ms compiler compatibility (the mingw/dev-cpp version of afxres.h essentially just includes the windows.h header and defines IDC_STATIC).
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  6. #6
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312
    #include <afxres.h>
    doesn't exist

    @Cool-August:
    doesn't work
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

  7. #7
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>doesn't exist<<

    Then you must be using a very old version. Not to worry, though, just #include <windows.h> as I mentioned initially.

    However, you might consider updating your compiler. If you're already using the latest dev-cpp, you might want to download updates to MinGW; w32api has updated headers and the latest, at time of writing, is w32api-3.6.tar.gz and does contain afxres.h.
    Last edited by Ken Fitlike; 03-07-2006 at 01:08 PM. Reason: typos
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  8. #8
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312
    I'll try it.
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM