Problem with double inheritance and new


I try to make a component, that shows a progressbar. It should work at the same time as my program makes the calculations (for a Mandelbrot-set) so it should be a thread.

My class-definition:

class ProgressBarComponent : public Component, public Thread ...

But I get a compiler error:

error C2385: Mehrdeutiger Zugriff von “new”.
könnte “new” in Basis “juce::Component” sein
oder könnte “new” in Basis “juce::Thread” sein

Means something as:

ambiguous access of “new”. Could be “new” in "juce::Component"
or could be “new” in “juce::Thread”

What am I doing wrong?

Thanks LukeS


just stick a juce_UseDebuggingNewOperator after your public methods and you’ll be safe


Now I get another error in

ProgressBarComponent::ProgressBarComponent(double* counter) { ... }

The error is:
error C2512: ‘juce::Thread’: Kein geeigneter Standardkonstruktor verfügbar
… ‘juce:Thread’: No adequate Standardkonstructor available



Well that’d be because Thread doesn’t have a default constructor… it takes a string.


Sory but I’m not familiar with multiple inheritance.
How should I write the constructor of my class that it calls the right construtor of the inherited Thread-class?

Thanks… LukeS


When you’re stuck on this kind of thing, the first thing I’d suggest is searching the jucer/juce demo code for it, e.g. “public Thread”, and see how it’s done there. This has nothing to do with multiple inheritance, it’s just how you write a constructor.


Thank… I got it
It compiles now properly.

Cheers LukeS


I just ran into the same problem. “yeah, just chuck this in”. God I love JUCE.