Author Topic: Resource compiler  (Read 5257 times)

Offline Newbie0815

  • Multiple posting newcomer
  • *
  • Posts: 59
Resource compiler
« on: June 18, 2011, 04:34:26 pm »
If I add an .rc file to my C::B application, I can include images into the .exe, like this

ID_icon_main ICON "icon_main.ico"

but as soon as I try to do anything else, like creating a dialog, I get all kinds of error, mostly syntax eror.
Elsewhere on the web I found out, thatīs because I need a resource compiler for that, including tons of notes, of how to compile an .rc with various resource compilers at the command line.

What I would need is a "translation", where and how the commands go into the C:B settings, so that "Build" will do the same as

g++ -c hello.cpp
windres resfile.rc
g++ -o hello.exe hello.o resfile.o -mwindows

Unter settings - compiler and debugger ... - toolchain executables, Iīve set the resource compiler to windres.exe, but it looks like thatīs not enough.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6590
    • My Best Post
Re: Resource compiler
« Reply #1 on: June 18, 2011, 06:11:32 pm »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Newbie0815

  • Multiple posting newcomer
  • *
  • Posts: 59
Re: Resource compiler
« Reply #2 on: June 18, 2011, 06:52:09 pm »
Letīs see,
Iīve started some years ago on WinXP with the all in one package from the C::B downloads, I think that was C::B 1.02, including MinGW/GCC 3.something.
Later Iīve updated my system to Vista, some C::B nightly including MinGW/GCC 4.something.
Recently Iīve updated to Win7 64bit, the latest C::B nightly, MinGW64/GCC 4.6

Right now Iīm running ALL of the above in VirtualPCīs PLUS twice Ubuntu in 32bit and 64bit with GCC 4.5

The problem is identical in ALL of these.
I can compile at the command line without problems, but Iīm missing where and how I have to put the command line options into the C::B settings.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6590
    • My Best Post
Re: Resource compiler
« Reply #3 on: June 18, 2011, 10:40:40 pm »
The output of your full build log is?
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Newbie0815

  • Multiple posting newcomer
  • *
  • Posts: 59
Re: Resource compiler
« Reply #4 on: June 18, 2011, 11:57:21 pm »
Iīve cut down the code to the minimum, just 2 files

main.cpp

Code: [Select]
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR szCmdLine,int nCmdShow)
{
return 0;
}

resource.rc

Code: [Select]
IDR_MYMENU MENU
BEGIN
        POPUP "&File"
        BEGIN
                MENUITEM "&Exit", ID_FILE_EXIT
        END
END

The complete output I get is

resource.rc line 5 syntax error

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6590
    • My Best Post
« Last Edit: June 19, 2011, 12:12:01 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6590
    • My Best Post
Re: Resource compiler
« Reply #6 on: June 19, 2011, 12:21:09 am »
This IS NOT a Code::Blocks issue, you need to include an header that defines ID_FILE_EXIT to the rc file.

When you find out the correct header feel free to ask where to put the search folder till then you need to do some work.

Project -> Build Options
Tab Search Directories
Sub-Tab "Resource Compiler"

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Newbie0815

  • Multiple posting newcomer
  • *
  • Posts: 59
Re: Resource compiler
« Reply #7 on: June 19, 2011, 11:21:07 am »
Oh well, now I feel stupid.
I got so puzzled by "syntax error" that I didnīt even think of the header.
I would have never guessed syntax error equals undefined.

Sorry to bother, but many thanks for clearing this up.