Thread: Resource Help

  1. #1
    Registered User mikeman118's Avatar
    Join Date
    Aug 2007
    Posts
    183

    Resource Help

    Hi, I'm using Visual C++ 2008 Express edition, and I was using a separate resource editor (it doesn't include one). Anyway, when I try to compile the application with the resource file it gives me this:
    error C2059: syntax error : 'constant'
    The problem isn't with the resource editor, as I've tried doing things manually as well. Here's what the resource file had in it (I know what's in it isn't the problem, as I've tried just using the last line of code which also turned up the same problem):
    Code:
    // Generated by ResEdit 1.3.3
    // Copyright (C) 2006
    // http://www.resedit.net
    
    #include <windows.h>
    #include "resource.h"
    
    IDD_DIALOG1 DIALOGEX 0,0,373,178
    STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_FIXEDSYS | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU
    CAPTION "Dialog"
    FONT 8,"MS Shell Dlg 2",400,0,1
    BEGIN
        PUSHBUTTON      "OK",IDAD,104,34,50,14,BS_DEFPUSHBUTTON
        PUSHBUTTON      "Cancel",IDCANCEL,160,33,50,14
        EDITTEXT        IDC_EDIT1,105,14,103,14,ES_AUTOHSCROLL
        LTEXT           "Static",IDC_STATIC,18,17,81,8
        LTEXT           "Static",IDC_STATIC,73,94,46,8
        LTEXT           "Static",IDC_STATIC,129,94,22,8
        LTEXT           "Static",IDC_STATIC,73,111,46,8
        LTEXT           "Static",IDC_STATIC,73,126,46,8
        LTEXT           "Static",IDC_STATIC,129,111,22,8
        LTEXT           "Static",IDC_STATIC,129,126,22,8
        LTEXT           "Static",IDC_STATIC,73,141,46,8
        LTEXT           "Static",IDC_STATIC,129,141,22,8
    END
    
    IDR_MENU1 MENU
    BEGIN
        POPUP ""
        BEGIN
        END
        POPUP "File"
        BEGIN
            MENUITEM "Set New Goal",IDM_SET_NEW_GOAL
            MENUITEM SEPARATOR
            MENUITEM "Exit",IDM_EXIT2
        END
        POPUP ""
        BEGIN
        END
        POPUP "Help"
        BEGIN
            MENUITEM "About",IDM_ABOUT
        END
    END
    
    IDI_ICON1           ICON          "money.ico"
    I haven't been able to find the answer anywhere else. Can anyone help me? Thanks.

    BTW when I double click on the error message it goes to the first line of the code, here:
    Code:
    IDD_DIALOG1 DIALOGEX 0,0,373,178

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Do you have IDD_DIALOG1 defined in you resource.h?

    gg

  3. #3
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    Code:
    IDR_MENU1 MENU
    BEGIN
        POPUP ""
        BEGIN
        END
        POPUP "File"
        BEGIN
            MENUITEM "Set New Goal",IDM_SET_NEW_GOAL
            MENUITEM SEPARATOR
            MENUITEM "Exit",IDM_EXIT2
        END
        POPUP ""
        BEGIN
        END
        POPUP "Help"
        BEGIN
            MENUITEM "About",IDM_ABOUT
        END
    END
    
    IDI_ICON1           ICON          "money.ico"
    i have stuff between the quotes. think syntax error could be from null string?

  4. #4
    Registered User mikeman118's Avatar
    Join Date
    Aug 2007
    Posts
    183
    Actually it turned out that I had accidentally include my .rc file, instead of my .h file. I don't know why it made a difference but it did.

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> error C2059: syntax error : 'constant'
    Ha! - should of noticed it was a (C/C++) compiler error....

    >>I don't know why it made a difference.....
    RC files are "compiled" by a resource compiler. The C/C++ compiler doesn't understand RC files.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting out a resource manager
    By psychopath in forum Game Programming
    Replies: 1
    Last Post: 11-10-2008, 07:12 PM
  2. unmanaged resource
    By George2 in forum C++ Programming
    Replies: 2
    Last Post: 01-03-2008, 04:23 AM
  3. CreateProcess with Resource of executable, not the Filename
    By Ktulu in forum Windows Programming
    Replies: 4
    Last Post: 11-04-2006, 01:07 AM
  4. resource problem/question
    By stallion in forum Windows Programming
    Replies: 4
    Last Post: 01-29-2003, 02:08 PM
  5. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM