How do people handle JUCE adding a class name that you already have?

Hi, since the addition of the new Grid class my builds are full of ambiguities - what’s the cleanest way to deal with this? thx

The best way to deal with ambigiuities is using namespaces.
All the juce classes are already in the juce namespace.

I have put all my code that is shared among several applications into a dedicated namespace. (like sb::MyClass)

Alternatively You could disable the using namespace juce: command with the
DONT_SET_USING_JUCE_NAMESPACE preprocessor directive.
However this would involve a ton of additional edits in your code. So I would not recommend doing that.

1 Like

… all good advice… but if it’s just the one class… I’d probably consider renaming my class (if possible).

Cheers,

Rail

1 Like

yeah, that’s what I did - only took 10 mins to sort out so figured that was the quickest way… cheers

Agh, please don’t bodge it by changing your class name!

The correct thing to do is to listen to soundbytes1’s advice and put all your own code into a namespace. That’s basic good C++ practice, and means you avoid ambiguities like this one (and others!)

2 Likes

I agree and this is something I’m going to do, but it’s obv more time consuming and so will be done in stages. The rename was the quick hack to keep me going as quickly as possible…