Author Topic: Problems compiling resources  (Read 5573 times)

Offline yckx

  • Multiple posting newcomer
  • *
  • Posts: 10
    • http://
Problems compiling resources
« on: November 10, 2005, 05:47:49 pm »
I've recently installed 1.0RC2 on my new macihne, and I'm having some problems compiling resource files.  I created a new resource file in Code::Blocks (why the XRC extension instead of RC?) and it didn't compile.  After looking around, I found that in the properties, neither the Compile nor Link boxes were checked, and that the compiler variable was set to CPP.  I don't understand why these were the defaults for a resource file, but I checked both boxes and changed the compiler variable to WINDRES.  Now I'm getting an error because Code::Blocks seems to be using the GCC compiler macro for windres.  Here's the log:

Project   : OpenGL Application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Documents and Settings\Jonathan\My Documents\coding\projects\opengl\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-g++.exe       -I"C:\Program Files\CodeBlocks\include" -c main.cpp -o .objs\main.o
windres.exe       -I"C:\Program Files\CodeBlocks\include" -c icon.xrc -o .objs\icon.o
windres.exe: invalid option -- c
Usage: windres.exe [option(s)] [input-file] [output-file]
 The options are:
  -i --input=<file>            Name input file
  -o --output=<file>           Name output file
  -J --input-format=<format>   Specify input format
  -O --output-format=<format>  Specify output format
  -F --target=<target>         Specify COFF target
     --preprocessor=<program>  Program to use to preprocess rc file
  -I --include-dir=<dir>       Include directory when preprocessing rc file
  -D --define <sym>[=<val>]    Define SYM when preprocessing rc file
  -U --undefine <sym>          Undefine SYM when preprocessing rc file
  -v --verbose                 Verbose - tells you what it's doing
  -l --language=<val>          Set language when reading rc file
     --use-temp-file           Use a temporary file instead of popen to read
                               the preprocessor output
     --no-use-temp-file        Use popen (default)
  -r                           Ignored for compatibility with rc
  -h --help                    Print this help message
  -V --version                 Print version information
FORMAT is one of rc, res, or coff, and is deduced from the file name
extension if not specified.  A single file name is an input file.
No input-file is stdin, default rc.  No output-file is stdout, default rc.
windres.exe: supported targets: pe-i386 pei-i386 elf32-i386 elf32-little elf32-big srec symbolsrec tekhex binary ihex
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 0 warnings

In Settings->Compiler->Other->Advanced options... the command line macro for "Compile single file to object file" is "$compiler $options $includes -c $file -o $object". The command line macro for "Compile Win32 resource file" is "$rescomp -i $file -J rc -o $resource_output -O coff $res_includes".  So it appears that even though windres.exe is being called, it's called with the wrong macro.  How can I correct this?  And how can I change the defaults so I don't have to check the boxes and change the compiler variable for each resource file I create?

Thanks.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Problems compiling resources
« Reply #1 on: November 10, 2005, 06:22:33 pm »
Quote
(why the XRC extension instead of RC?)

Two different things: XRC is a wxWidgets resource while RC is a windows resource. Why would you create a XRC file when you want to create a RC?  :shock:
Be patient!
This bug will be fixed soon...

Offline yckx

  • Multiple posting newcomer
  • *
  • Posts: 10
    • http://
Re: Problems compiling resources
« Reply #2 on: November 10, 2005, 10:13:08 pm »
Why would you create a XRC file when you want to create a RC?  :shock:
That's what Code::Blocks gave it when I did File->New File abd set Save as type: "Resource files (*.xrc;*.rc)".

It works as expected now that I specify "filename.rc" in the filename field.  Still not sure why it should default to XRC, but I can live with typing in the extension ;)

I want to thank all who work on Code::Blocks.  I really prefer it to Dev-C++ and Microsoft's Visual stuff.  I Haven't really had the opportunity to compare it to other IDEs, but I don't see myself switching any time soon.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Problems compiling resources
« Reply #3 on: November 10, 2005, 10:28:56 pm »
Quote
Still not sure why it should default to XRC

You probably didn't write the extension yourself, so it used the first in the list. This is how windows open-file dialogs work...
Anyway, glad you got it working now.
Be patient!
This bug will be fixed soon...