User forums > Using Code::Blocks

Compiling xrc files

(1/1)

Belgabor:
Hi everybody,

I need advice on how to better use xrc files with C::B. I want to use wxrc to generate cpp files which I then include in my project.
Currently I add the xrc files to my project, activate the compilation in their properties and give them a custom compilation command line like this:

--- Code: ---wxrc --extra-cpp-code --cpp-code --output=xrc_effect.cpp --function=InitXmlEffect $file

--- End code ---
I added the resulting cpp files to my project and they are compiled normally.

Unfortunately this approach leads to two problems:
[*]The xrc files are always compiled
[*]Once the build runs, it doesn't detect that the resulting cpp files were updated and are therefore they are not compiled on the first run.
[/list]

Any help appreciated...

Charon:
You could create 2 projects in one workspace.
The first project should only contain your xrc's while your second projects contains the cpp's.

Now create a virtual target that contains both these projects.
When you build this new target both projects get built. The project with the xrc's should be compiled first of course so that the second project has the new cpp's.

There may be better solutions through dependencies but i never worked with them (and don't have the time right now to try them out). This was just the first thing that came to my mind.

Good luck
Markus

tiwag:
even better: use different targets in your project,

target xrc-precompiling
 - set external dependencies to your .xrc's (e.g. to controls.xrc)
 - process your xrc's with wxrc there  ( e.g. controls.xrc --> control.cpp / controls.h )

target build-myapp
 - put your precompiled .cpp / .h files ( e.g. controls.cpp / controls.h ) in this target
   and it will be compiled if any changes happened

Belgabor:
Works great, thanks! :D

kisoft:
I being used Priority and special build command for analogical situations.
For example, I did include filename.yac and set priority 20 for him. Also special command for compile only this file.
After compile was created file filename.yy.c. I did include this file to my project and set him priority 90.

Compile sequence:
filename.yac
.. another files of my project ..
filename.yy.c

May be this method help you too.
Good luck!

Navigation

[0] Message Index

Go to full version