What is this? DELETEME candidate?

HOW TO CREATE AND ADD RESOURCE FILES INTO PROJECTS

I consider a sample project with three files involved:

ids.h: a CPP header file which is included into the resource file.

resource.rc: the resource file itself.

main.cpp: the main CPP program file.

It is supposed you know how to create a header file and the main program file, but how to create a resource file?

1. Create a new file on the way it would be easier for you, for example: Click on File menu, then New File, Other type File and finally we select an Empty File.

2. Select a proper name for your resource file and click on Finish.

3. Write the code for your resource file and save changes (for this tutorial I have chosen resource.rc).

Now we have all the three files and now we will add resource.rc to our project following the next steps:

1. Right-click on resource.rc and select propierties. Now we are in File Propierties - resource file.

2. On Categories -> General be aware that on Item Configuration Tool it is selected Custom Build Tool.

3. Fill out the following fields as in the picture. Command Line: windres.exe resource.rc resource.o

Since I am using MinGW I will use MinGW’s resource compiler windres.exe. You should enter the resource compiler you are currently using with its proper options. Description: Compiling resources… Here you can optionally write a text which will be printed on screen during project’s compiling process. Outputs: resource.o Outputs are files generated by the command line we have entered before, in this case the only output is resource.o. Additional Dependencies: ids.h In this option we write files which are included into our resource file. (i.e. #include “ids.h”). 4. Apply changes and press OK buttom. 5. At this point we need to setup project’s properties: right-click on project’s name and select Properties, then click on Linker configuration. 6. Click on Libraries , then on Add Option, select Other Option , finally enter the name of the compiled resource file, in this case resource.o, and press OK buttom. 7. Next step consists in adding Additional Dependencies from Project Propierties context menu (see step number 5) , enter the resource file’s name and press OK buttom. 8. Finally we must Apply changes and press OK buttom. Thus we have added a resource file (resource.rc) into our project.

Add new attachment

In order to upload a new attachment to this page, please use the following box to find the file, then click on “Upload”.
« This page (revision-4) was last changed on 01-Aug-2009 18:57 by Janne Jalkanen