Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: Newbie0815 on June 18, 2011, 04:34:26 pm

Title: Resource compiler
Post by: Newbie0815 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.
Title: Re: Resource compiler
Post by: stahta01 on June 18, 2011, 06:11:32 pm
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F


OS Name and Version?
Compiler name and Version?

Tim S.
Title: Re: Resource compiler
Post by: Newbie0815 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.
Title: Re: Resource compiler
Post by: stahta01 on June 18, 2011, 10:40:40 pm
The output of your full build log is?
Title: Re: Resource compiler
Post by: Newbie0815 on June 18, 2011, 11:57:21 pm
I´ve cut down the code to the minimum, just 2 files

main.cpp

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

resource.rc

Code
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
Title: Re: Resource compiler
Post by: stahta01 on June 19, 2011, 12:10:17 am
The output of your full build log is?


http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

CB Version or SVN number?

Tim S.
Title: Re: Resource compiler
Post by: stahta01 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.
Title: Re: Resource compiler
Post by: Newbie0815 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.