Undefined symbol: createPluginFilter()

#include <JuceHeader.h>

#include “MoonlightGrainDelayAudioProcessor.h”

#include “MoonlightGrainDelayAudioProcessorEditor.h”

MoonlightGrainDelayAudioProcessor::MoonlightGrainDelayAudioProcessor()

{

// Initialize your parameters and member variables here (if any).

}

MoonlightGrainDelayAudioProcessor::~MoonlightGrainDelayAudioProcessor()

{

}

void MoonlightGrainDelayAudioProcessor::prepareToPlay(double sampleRate, int samplesPerBlock)

{

// Implement any initialization needed before audio processing starts.

}

void MoonlightGrainDelayAudioProcessor::releaseResources()

{

// Implement any cleanup here.

}

void MoonlightGrainDelayAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)

{

// Implement your grain delay processing here.

// You can use the buffer to read/write audio data and midiMessages for MIDI data (if required).

}

juce::AudioProcessorEditor* MoonlightGrainDelayAudioProcessor::createEditor()

{

return new MoonlightGrainDelayAudioProcessorEditor(*this);

}

bool MoonlightGrainDelayAudioProcessor::hasEditor() const

{

return true ;

}

const juce::String MoonlightGrainDelayAudioProcessor::getName() const

{

return “Moonlight Grain Delay V2”;

}

// here’s part of the code im building a grain delay plugin using c++
but im getting this error:
Undefined symbol: createPluginFilter()

The createPluginFilter()
Actually isn’t anywhere in my code but I’m still getting that error which makes me think it’s an issue with a linked file from juce or something

JUCE expects that you define it yourself, and make it return the pointer to a new instance of your AudioProcessor. That’s how JUCE knows what AudioProcessor it must wrap with its various plug-in wrappers, and that’s why it expects the symbol to be defined.

Put in your .cpp file something like this:

//==============================================================================
// This creates new instances of the plugin..
juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter()
{
    return new MoonlightGrainDelayAudioProcessor();
}

Hey thank you so much! Where in the cpp should I put it?
I have a pluginProcessor.cpp and a pluginEditor.cpp

To the compiler, it doesn’t matter much where that function is defined, as long as the linker can find it.

Conceptually, I’d say it belongs to the pluginProcessor.cpp file, and that’s where I would put it.

Inside that file, any place after the #include directives is good. If you place it at the very end of the file, you can be sure that whatever definition you need inside that function, it has already been provided by the code above it.

#include <JuceHeader.h>

#include “MoonlightGrainDelayAudioProcessor.h”

#include “MoonlightGrainDelayAudioProcessorEditor.h”

MoonlightGrainDelayAudioProcessor::MoonlightGrainDelayAudioProcessor()

{

// Initialize your parameters and member variables here (if any).

}

MoonlightGrainDelayAudioProcessor::~MoonlightGrainDelayAudioProcessor()

{

}

void MoonlightGrainDelayAudioProcessor::prepareToPlay(double sampleRate, int samplesPerBlock)

{

// Implement any initialization needed before audio processing starts.

}

void MoonlightGrainDelayAudioProcessor::releaseResources()

{

// Implement any cleanup here.

}

void MoonlightGrainDelayAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)

{

// Implement your grain delay processing here.

// You can use the buffer to read/write audio data and midiMessages for MIDI data (if required).

}

juce::AudioProcessorEditor* MoonlightGrainDelayAudioProcessor::createEditor()

{

return new MoonlightGrainDelayAudioProcessorEditor(*this);

}

bool MoonlightGrainDelayAudioProcessor::hasEditor() const

{

return true ;

}

const juce::String MoonlightGrainDelayAudioProcessor::getName() const

{

return “Moonlight Grain Delay V2”;

}

juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter()

{

return new MoonlightGrainDelayAudioProcessor();

}

// when I added this at the end of the file you recommended I received this error:
/Users/chandler/Documents/CODING/Moonlight Grain Delay/Moonlight Grain Delay

V2/NewProject/Source/MoonlightGrainDelayAudioProcessor.cpp:47:16 Allocating an object of abstract class type ‘MoonlightGrainDelayAudioProcessor’

Just a note that you can format code by putting 3 backticks before and after the code (`). :slight_smile:

That means that your class MoonlightGrainDelayAudioProcessor should provide a function definition for some of the functions that are pure virtual in the base class AudioProcessor.
The name(s) of the functions that are missing a definition, should appear in the informations that precede or follow the error message quoted above.

If that is new to you, I suggest you improve your general knowledge of the basics of C++ before you dive into developing with JUCE, otherwise it all may end up looking more complicated than it really is.