I have predefined DONT_SET_USING_JUCE_NAMESPACE for my entire project. But this gives me some problems with:


I solved this by adding


at the top of each of these files.

Now, I bring this up because of the following text in these 3 files :slight_smile:

“*** DON’t EDIT THIS FILE!! ***
If there’s a bug or a function you need that can’t be done without changing some of the code in here, give me a shout so we can add it to the library, rather than branching off and going it alone!”

I would say that if JUCE offers the possibility to disable “using namespace JUCENAMESPACE” in the juce header, it should be considered a bug that these files don’t compile without it, so maybe you could adopt this change?

Thanks and best regards,


Well, the end result of your changes would be that some files have the juce namespace and some don’t, so that just won’t work.

Is there a reason you don’t want to use the juce namespace? I find that even with it, you’ll run into conflicts between names - at least with the namespace, you can do juce::Component and get around it easily.


No, no, I DO want to use the juce namespace, I just don’t want it to set always, which is what juce does by default. I prefer to use my namespaces at a fine-grained level, either explicitely, or sometimes just for a specific class at source file level, but never in such a global way.

Undefining this predefined macro in these 3 files will revert their behaviour to their default, while not forcing the namespace everywhere else.

Maybe I’m not getting it then. My understanding was that if you set (or leave set) the definition then everything would be defined in the namespace, i.e. juce::Point etc.

And that the other classes, when referring to each other, would expect them to be in the same namespace, otherwise it would be potluck whether they got the ‘right’ class?