News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Resource compiler

Started by Newbie0815, June 18, 2011, 04:34:26 PM

Previous topic - Next topic

Newbie0815

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.

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Newbie0815

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.

stahta01

The output of your full build log is?
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Newbie0815

I´ve cut down the code to the minimum, just 2 files

main.cpp


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


resource.rc


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

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Newbie0815

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.