Undefined symbols when adding FileDragAndDropTarget class

So I’ve created a new project, with a new component that is added to the mainComponent.

When inheriting from FileDragAndDropTarget, I add the required virtual functions (along with the rest of the class methods). Additionally, I have implemented the methods in the .cpp file.

I don’t understand why I can’t build. I get multiple error as soon as I try to inherit from this class. As soon as I remove all relevant methods and inheritance, the project builds.

Any help would be great :slight_smile:

Are you including the JUCE header?


it appears to be a linker error: AudioContainer is your class and the linker is only finding its declaration (what’s the .h file) but not the definition (what goes in the .cpp file).

Check that you have marked the corresponding .cpp file for compilation in the target that you are building

And check, that you added the namespace in your cpp file:

// wrong: is not implemented in your class, but doesn't show up as error, since it is just a global method
void isInterestedInFileDrag (const StringArray &files)
    return true;

// right: method is implemented in the class
void AudioContainer::isInterestedInFileDrag (const StringArray &files)
    return true;
1 Like

That was it. Completely missed the namespace. Definitely won’t make that silly mistake again.


1 Like


Oh, how often I said that :joy:
but now you know where to look

wow! that was a hell of a guessing without looking at the .cpp! :clap: