News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Resources

Started by Decrius, February 05, 2006, 04:32:00 PM

Previous topic - Next topic

Decrius

Hello all, I'm new here. Code::Blocks is great, but I have one problem.

I have Icon's and Menu's that I want to place in a resource file. The Icon I define with LoadImage...

But I couldn't find anything in the editor to do something with resources.

What extension should a resource have?
How to 'link' them to your file?
A comprehensive question: What and how with resources.

I hope someone can answer here, I tried the DevShed forum, but they didn't knew anything about resources in Code::Blocks.

Decrius
Check out my website: [url="http://www.daevius.com"]http://www.daevius.com[/url]

TDragon

The underlying structure for Win32 resources in any IDE is the .rc file. In Code::Blocks, if you add a file with the .rc extension to your project, it will be compiled with the resource compiler and linked into your program.

Unfortunately I've never come across a good reference for the structure of a .rc file (maybe someone else can chime in here?); I just learned by looking at the contents of the files Visual Studio produces.

Also, I've started using wxWidgets for all my GUI development, which sits on top of all the Win32 functionality and uses a different format for its resources, and is in my humble opinion far and away easier to work with.
[url="https://jmeubank.github.io/tdm-gcc/"]https://jmeubank.github.io/tdm-gcc/[/url] - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Decrius

Okay, thank you, with project you mean just a .c file? Or that thing they put into the program which does everything except what I need (GUI project thing)?
Check out my website: [url="http://www.daevius.com"]http://www.daevius.com[/url]

Decrius

I tried the console application project, deleted the main.c, added the .c file of my GUI program, added the resource file (.rc). But when I try to compile (is that the same as 'build'?) it says in the build log:

gcc: Files\CodeBlocks\include\taco\resources\resource.rc: No such file or directory
gcc: warning: `-x c' after last input file has no effect
gcc: no input files
windres.exe: no resources
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 1 warnings

While I selected the resource from the list!

Decrius
Check out my website: [url="http://www.daevius.com"]http://www.daevius.com[/url]

Decrius

I think I got it working, maybe project are better than I thought :D

Decrius
Check out my website: [url="http://www.daevius.com"]http://www.daevius.com[/url]

kkez

#5
Quote from: TDragon on February 05, 2006, 04:51:03 PMUnfortunately I've never come across a good reference for the structure of a .rc file (maybe someone else can chime in here?);

Resource definition statement.

Oh, hi Decrius  :P

kkez

#6
btw, my .rc file no longer have the syntax highlighting even if the filemask for the lexer is .rc... (bug?)

Now, if i change the highlight mode in the edit menu, all the [ + ] to unfold the blocks of code disappear even if the line count remains the same. I just can't unfold it again  :( (bug?)

EDIT: wait, all the lexers switched by one from the D lexers: the D lexer has the fortran77 filemask and so on... better go look inside the default.conf file...

takeshimiya

Quote from: kkez on February 05, 2006, 06:00:54 PM
btw, my .rc file no longer have the syntax highlighting even if the filemask for the lexer is .rc... (bug?)

Now, if i change the highlight mode in the edit menu, all the [ + ] to unfold the blocks of code disappear even if the line count remains the same. I just can't unfold it again  :( (bug?)

EDIT: wait, all the lexers switched by one from the D lexers: the D lexer has the fortran77 filemask and so on... better go look inside the default.conf file...

That's a bug: the lexers are indexed by IDs.

kkez

everything is fine now, i just deleted everything between <color_sets> and </color_sets>. Maybe in the previous revision the lexers were read in the order they are and my conf file still had the old list...

takeshimiya

Quote from: kkez on February 06, 2006, 12:12:04 PM
everything is fine now, i just deleted everything between <color_sets> and </color_sets>. Maybe in the previous revision the lexers were read in the order they are and my conf file still had the old list...
Yes, that's because they're being indexed by IDs, which will screw up all the lexers when a new lexer get's added. :)