Multiple inheritance problem


#1

I’ve been staring at this cryptic error message for far too long, so I’m hoping that some other jucer can show me the light. The error looks like this:

maincontentcomp.cpp(50) : error C2385: ambiguous access of 'delete’
could be the ‘delete’ in base 'juce::Component’
or could be the ‘delete’ in base 'juce::ApplicationCommandTarget’
This diagnostic occurred in the compiler generated function ‘void *mainContentComp::__delDtor(unsigned int)’

and the maincontentcomp class is defined:

class mainContentComp :
public Component,
public ActionListener,
public ActionBroadcaster,
public Timer,
public MenuBarModel,
public ApplicationCommandTarget

this code compiles under Xcode, but chokes under VS, if that helps.


#2

you need to have the ‘juce_UseDebuggingNewOperator’ in your class declaration.


#3

Bingo! Give the man in the back a prize.

I’m going to spend the rest of my day gluing my hair back on.


#4

Bingo! Give the man in the back a prize.

I’m going to spend the rest of my day gluing my hair back on.[/quote]

Thank goodness for the forums! I also was staring befuddled at this compile error when inheriting from multiple JUCE classes. To help others in the future, here’s a simple example that works:

[code]#include “juce.h”

class blah : public Component,
public DragAndDropContainer
{
public:
blah();

// Magic to eliminate multiple inheritance problem regarding ambiguous use of
// delete in blah::__delDtor
juce_UseDebuggingNewOperator

};

blah::blah()
{

}
[/code]

After the excitement of successful compilation dies down, I’ll have to dig into this to understand what’s going on…

Regards,
Chris


#5