Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » windows resource files
windows resource files [message #149027] Sat, 16 July 2005 08:18 Go to next message
Eclipse UserFriend
Dear all,

I want to add a resource file for my win32 app. My project is a managed
build C++ project. Now I am stuck on how to just add a resource file and
compile it along with the code:

1. MinGW doesn't come with a resource compiler as far as I know;
2. Even if I get one resource compiler I don't know how to integrate it to
the CDT environment. I still want to use the managed build feature.

Could anyone give me a hand?

Ben
Re: windows resource files [message #149043 is a reply to message #149027] Sat, 16 July 2005 11:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: j_apter.hotmail.com

I believe MinGW comes with windres (Windows resource file compiler). As
for integrating it into a managed make in CDT, I don't know, hopefully
someone else can answer that...

benben wrote:

> Dear all,

> I want to add a resource file for my win32 app. My project is a managed
> build C++ project. Now I am stuck on how to just add a resource file and
> compile it along with the code:

> 1. MinGW doesn't come with a resource compiler as far as I know;
> 2. Even if I get one resource compiler I don't know how to integrate it to
> the CDT environment. I still want to use the managed build feature.

> Could anyone give me a hand?

> Ben
Re: windows resource files [message #149059 is a reply to message #149043] Sat, 16 July 2005 21:18 Go to previous messageGo to next message
Eclipse UserFriend
Ok, as there is only one and written resource file, I can really manually
compile it separately. But is there a way to tell the linker to link with
resource? Or, is there a way to add a few lines to the make file and still
have the managed build system going?

ben
Re: windows resource files [message #149122 is a reply to message #149059] Sun, 17 July 2005 23:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dschaefer.rogers.com

benben wrote:
> Ok, as there is only one and written resource file, I can really manually
> compile it separately. But is there a way to tell the linker to link with
> resource? Or, is there a way to add a few lines to the make file and still
> have the managed build system going?
>
> ben
>
>

We should add handling of windres to the gnu on windows toolset. If it's
not there, please raise a bug in bugzilla.

Thanks,
Doug
Re: windows resource files [message #149502 is a reply to message #149059] Mon, 18 July 2005 06:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: e.egberts.tantec.de

> Ok, as there is only one and written resource file, I can really manually
> compile it separately. But is there a way to tell the linker to link with
> resource? Or, is there a way to add a few lines to the make file and still
> have the managed build system going?

Yes, you can add the compiled resource like every other library. If
there is maybe an icon resource, you can name it "libicon.a" and add it
as "icon" to Properties-> Build-> Linker-> Libraries. After that you can
load the resource and access the members by resource-id.
Re: windows resource files [message #149524 is a reply to message #149502] Mon, 18 July 2005 23:26 Go to previous messageGo to next message
Eclipse UserFriend
> Yes, you can add the compiled resource like every other library. If
> there is maybe an icon resource, you can name it "libicon.a" and add it
> as "icon" to Properties-> Build-> Linker-> Libraries. After that you can
> load the resource and access the members by resource-id.

Thanks for your reply! That solves my problem!

I'm thinking, C++ guys hardly do Java, but since CDT is written in java and
without a C++ interface, to extended is kinda hard for us...

ben
Re: windows resource files [message #149636 is a reply to message #149027] Wed, 20 July 2005 09:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: david.wrigley.zen.co.uk

Not sure if this is the best way...
1. I create a batchfile (res.bat) in the workspace for the project.
This contains one line:

windres --use-temp-file -i myfilename.rc -o Debug\myfilename_rc.o --define
__WXMSW__ --define __WXDEBUG__ --include-dir c:\wxwin\include
--include-dir c:\wxwin\lib\gcc_lib\mswd --include-dir .

(as you can see, this is using wxwidgets, so yours may be different)

2. I create a builder in 'Project / Properties/ Builders' called Resources
With location ${workspace_loc:/myprojectfolder/res.bat}
and ${workspace_loc:/myprojectfolder}

Works fine for me
Would like to know if there is a better way.
Re: windows resource files [message #149690 is a reply to message #149636] Thu, 21 July 2005 07:57 Go to previous messageGo to next message
Eclipse UserFriend
> Not sure if this is the best way...
> 1. I create a batchfile (res.bat) in the workspace for the project.
> This contains one line:
>
> windres --use-temp-file -i myfilename.rc -o Debug\myfilename_rc.o --define
> __WXMSW__ --define __WXDEBUG__ --include-dir c:\wxwin\include
> --include-dir c:\wxwin\lib\gcc_lib\mswd --include-dir .
>
> (as you can see, this is using wxwidgets, so yours may be different)
>
> 2. I create a builder in 'Project / Properties/ Builders' called Resources
> With location ${workspace_loc:/myprojectfolder/res.bat}
> and ${workspace_loc:/myprojectfolder}
>
> Works fine for me
> Would like to know if there is a better way.
>

Thanks David! I can see that's a good point. I have never added a builder
before! So these are all the little things I have to handle switching from
Visual Studio...

Ben
Re: windows resource files [message #794958 is a reply to message #149690] Thu, 09 February 2012 17:41 Go to previous message
Eclipse UserFriend
This works too:
Project | Properties | C/C++-Build | Settings | Build Steps | Pre-Build Steps | Command: windres --use-temp-file -i..\MyProject.rc -o..\MyProject_rc\MyProject_rc.o

Project | Properties | C/C++-Build | Settings
Tool Settings | MinGW C++ Linker | Miscellaneous | Other Objects
click the icon 'Add'
fill in "C:\MyWorkspace\MyProject\MyProject_rc\MyProject_rc.o"

You have to add the folder .\MyProject_rc before you build
Previous Topic:Compiling Windows resources (.rc)
Next Topic:Resource-scriptfiles, Win32API
Goto Forum:
  


Current Time: Sat May 10 09:41:04 EDT 2025

Powered by FUDForum. Page generated in 0.03490 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top