Code::Blocks Forums

User forums => Help => Topic started by: FLMason on February 19, 2008, 03:22:30 am

Title: How to get Windows Resources to compile and link with C::B and MinGW?
Post by: FLMason on February 19, 2008, 03:22:30 am
Hi Everyone,
   An old mainframe programmer here, trying the new stuff.

I'm working through a Windows API tutorial and am attempting a DialogBox... which needs a Windows Resource (.rc) apparently.

In trolling around the web, seems like a Windows Resource Compiler is required. I found some old screen shots that seem to show a Resource Compiler Directory Window in older versions of C::B.

However, this doesn't appear in my Compiler Window.

So can anyone point to me info on how to obtain, and install a Windows Resource Compiler?
Title: Re: How to get Windows Resources to compile and link with C::B and MinGW?
Post by: MortenMacFly on February 19, 2008, 08:46:28 am
So can anyone point to me info on how to obtain, and install a Windows Resource Compiler?
A Windows resource compiler comes with the GCC (MinGW) compiler suite for Windows. It's called "windres.exe" Besides the usual compiler setup you shouldn't need anything special. "windres.exe" is setup as the default resource compiler for C::B. Of course you need to add the RC file to your project to get C::B compile and link it.
Title: Re: How to get Windows Resources to compile and link with C::B and MinGW?
Post by: severach on February 29, 2008, 04:00:54 am
Add the resource to your project and CodeBlocks will include it in the compile. MinGW provides windres.exe as the resource compiler. Some Microsoft compilers require you to download the SDK to get the resource compiler. Other compilers include their own resource compilers.
Title: Re: How to get Windows Resources to compile and link with C::B and MinGW?
Post by: thomas on February 29, 2008, 08:14:45 am
Please do note that windres has to be able to call gcc sometimes (for preprocessing).
If you happen to use the gcc 4.2.1 version of MinGW, then you should copy (or hardlink, if you use XP/Vista) mingw32-gcc-DW2 (or -SJLJ) to gcc, else windres will fail. You can do that for all of the mingw32-foobar-DW2/SJLJ programs for simplicity, but gcc is necessary if you want to use windres.

In the older 3.4 build, MinGW team has already done that, but it seems that this was forgotten in the 4.2.1 build. It isn't a big issue, but it's one thing that can be the cause of many headaches, as the error "CreateProcess failed (Error 0)" is not really helpful if you don't know...
Title: Re: How to get Windows Resources to compile and link with C::B and MinGW?
Post by: Sledgehammer_999 on March 02, 2008, 01:28:08 am
thank you thomas. I was about to ask here because it failed to compile the "example wxwidget project" when trying to compile resource.rc with the error "preprossecing failed"