0

When I try to use windres (Included with MinGW) to compile my .rc file using the tutorial here, it gives me the following error (I put "windres my.rc -O coff -o my.res" into the command line):

cpp: Too many arguments
windres: my.rc:1: syntax error

my.rc is as follows:

1 ICON "C:\Users\Owner\Desktop\LonelyPlanet\LonelyPlanetIcon.ico"
2 VERSIONINFO
FILEVERSION     1,0,0,0
PRODUCTVERSION  1,0,0,0
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "040904E4"
    BEGIN
      VALUE "CompanyName", "Neil Flodin"
      VALUE "FileDescription", "A game I made at iD tech camp!"
      VALUE "FileVersion", "1.0"
      VALUE "InternalName", "Lonely_Planet"
      VALUE "LegalCopyright", "Copyright(c) Neil Flodin All Rights Reserved"
      VALUE "OriginalFilename", "Lonely Planet.exe"
      VALUE "ProductName", "Lonely Planet"
      VALUE "ProductVersion", "1.0"
    END
  END

  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x409, 1252
  END
END

Is there anything weird that I'm doing with my rc file/command line input, and if so, how could I make windres compile it?

-Neil

Community
  • 1
  • 1
Neil Flodin
  • 578
  • 7
  • 22
  • Could you try changing the path name to use forward slashes `/` rather than backslashes `\\`? – Jesse Good Jul 01 '12 at 23:34
  • It still gives me the same error for some reason... – Neil Flodin Jul 01 '12 at 23:39
  • The problem is with the long path name I believe, try moving the icon to directly under the C drive and make the path `C:/LonelyPlanetIcon.ico`, (always forward slashes!) or put the file together with the .res file and just type "LonelyPlanetIcon.ico" it should work. – Jesse Good Jul 01 '12 at 23:50
  • Still same error... :( I have no idea why, though. I even ditched the ICON line and it gets the same error – Neil Flodin Jul 02 '12 at 00:01
  • Last guess, try `windres my.rc -o my.res` without specifying the file format (I tried your file here, and I successfully compiled it). – Jesse Good Jul 02 '12 at 00:09
  • Sadly, the same thing... I'm going to reinstall windres at this point. – Neil Flodin Jul 02 '12 at 00:12

2 Answers2

2
#include <winresrc.h>
IDR_MAINFRAME           ICON                    "main.ico"
VERSIONINFO
...
END

add resource.h

#define IDR_MAINFRAME                   128
paul
  • 21
  • 2
0

I have provide a possible solution to a similar problem (Windres syntax error) posted 4 years ago from today.

I hope it can helps. The point is that you can try to compile the .rc file in the same way, but using Cygwin, and obtaing a .o file instead a .res one, that you can use in the linking process.

elcortegano
  • 2,444
  • 11
  • 40
  • 58