Resources encapsulation in Juce


Hi all,

As far as I understand, the common way to encapsulate some resources within an executable file in Juce is to use binary builder to encode files into .cpp files, right? Is this the only way to do this? I don’t dislike it, just want to know more about this stuff since there’s a lot of encapsulation work pending in my project. Thanks.


I’d go with the binary builder %100…

This way you don’t have to depend on the IDE for storing and bundling “resource” especially if your working on a cross platform project. XCode and Visual Studio for example have completely different ways in which they store and include resources.

I also use binary builder for a custom build/version system for my project(s), running it as a pre build phase to generate resources etc…

Also, loading the data is easy.



Yeah, looks like this is the best way to go. Thanks for the advice.


i use JUCER whenever i can, it’s the same principle it’s just more useful. I also try to keep all my components be JUCER based so the codebase for a more complicated app is much clearer.


Generally this is true. But the Jucer stores each resource in the generated cpp file, and duplicate resources may be a problem when using the same ones over and over in several components. Not a biggie, but it bloats the executable. Sometimes I intentionally use the Jucer only to store placeholders for my virtual classes, then I manually load the images and stuff for them later.


that’s true, but you can re-use each re4source in all classes, so there is no need to copy resources across components. just include the component H file and use the resources like any other.