Problems with DONT_SET_USING_JUCE_NAMESPACE

Hi,

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

juce_VstWrapper.cpp
juce_StandaloneFilterWindow.cpp
juce_AudioFilterStreamer.cpp

I solved this by adding

#undef DONT_SET_USING_JUCE_NAMESPACE

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,

maarten

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.

Bruce

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?

Bruce