Namespace clashing with Reverb


#1

Hi,

I am in the process of upgrading our program from Juce 1.43 to the latest release. In the latest Juce there has been an addition of a Reverb class. This is clashing with our own Reverb class and giving ambiguity errors. So I wrapped our Reverb is in own namespace:

/////////// Reverb.h /////////////
#include “SomeBaseClassThatUsesJuce.h”

namespace myreverb {
class Reverb:SomeBaseClass {

}
}

////////// Reverb.cpp ////////////
myreverb::Reverb::Reverb(){

}

Which in theory should work, but now I am getting an error in juce.h at the line:
namespace JuceDummyNamespace {}

What is the way around this? I can’t change the name Reverb, because it is part of a larger xml preset system, if I change the name then user presets are broken. Sorry if I am missing something really obvious!


#2

I think that the comment around the “dummy namespace” Juce line is meant to explain that you are getting the error because you have an unbalanced curly brace pair ( “{” and “}” )


#3

the class definition requires a ; at the end

class Reverb:SomeBaseClass {

};

#4

As the previous posters have indicated, this is probably a misleading compiler error.

Overall, Juce is in its own namespace, so it’s unlikely there will ever be any actual collisions - you can always use the explicit name, ::yournamespace::YourClass or even ::YourClass if it’s at top-level.

There’s also a JUCE compilation option that prevents the juce namespace from being brought into the main namespace with “using”. I like to know where my classes are coming from, so I use that - and then I have a header file rather a lot of statements looking like:

[code]namespace rec { // that’s me!

typedef juce::String String;
/// etc.[/code]for all the Juce classes I use a lot.