Problem with double inheritance and new


#1

Hi
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


#2

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


#3

Now I get another error in

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

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

Cheers


#4

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


#5

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


#6

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.


#7

Thank… I got it
It compiles now properly.

Cheers LukeS


#8

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


#9