Error LNK2019: unresolved external symbol "public: void __cdecl juce::dsp::LookupTableTransform


pretty new to JUCE. Followed this tutorial to setup the env. It compile and run well.
Now, I’m trying to introduce an LFO using LookupTable on my Audio Plugin.

So I’ve add this on PluginProcessor.h:

#include <juce_dsp/juce_dsp.h>
class AudioPluginAudioProcessor  : public juce::AudioProcessor
    static constexpr size_t lfoUpdateRate = 100;
    size_t lfoUpdateCounter = lfoUpdateRate;
    juce::dsp::Oscillator<float> lfo;

and this on PluginProcessor.cpp:

    : AudioProcessor(BusesProperties()
#if !JucePlugin_IsMidiEffect
#if !JucePlugin_IsSynth
                         .withInput("Input", juce::AudioChannelSet::stereo(), true)
                         .withOutput("Output", juce::AudioChannelSet::stereo(), true)
    addParameter(gain = new juce::AudioParameterFloat("gain", // parameterID
                                                      "Gain", // parameter name
                                                      0.0f,   // minimum value
                                                      1.0f,   // maximum value
                                                      0.5f)); // default value

    lfo.initialise ([] (float x) { return std::sin(x); }, 128);
    lfo.setFrequency (3.0f);

but when I do:

cmake -B cmake-build
cmake --build cmake-build

it says this:

error LNK2019: unresolved external symbol “public: void __cdecl juce::dsp::LookupTableTransform::ini
tialise(class std::function<float __cdecl(float)> const &,float,float,unsigned __int64)” (?initialise@?$LookupTableTransform@M@dsp@juce@@QEAAXAEBV?$funct
ion@$$A6AMM@Z@std@@MM_K@Z) referenced in function “public: __cdecl juce::dsp::LookupTableTransform::LookupTableTransform(class std::functio
n<float __cdecl(float)> const &,float,float,unsigned __int64)” (??0?$LookupTableTransform@M@dsp@juce@@QEAA@AEBV?$function@$$A6AMM@Z@std@@MM_K@Z) [C:\repo
MyNewPlugin_SharedCode.lib(PluginProcessor.obj) : error LNK2019: unresolved external symbol "public: __cdecl juce::dsp::LookupTable::LookupTable<float

(void)" (??0?$LookupTable@M@dsp@juce@@QEAA@XZ) referenced in function “public: __cdecl juce::dsp::LookupTableTransform::LookupTableTransform(class std::function<float __cdecl(float)> const &,float,float,unsigned __int64)” (??0?$LookupTableTransform@M@dsp@juce@@QEAA@AEBV?$function@$$A6AMM@Z@
std@@MM_K@Z) [C:\repos\JUCE\MyNewPlugin\cmake-build\AudioPluginExample_VST3.vcxproj]
C:\repos\JUCE\MyNewPlugin\cmake-build\AudioPluginExample_artefacts\Debug\VST3\MyNewPlugin.vst3\Contents\x86_64-win\MyNewPlugin.vst3 : fatal error LNK1120: 2 unresolv
ed externals [C:\repos\JUCE\MyNewPlugin\cmake-build\AudioPluginExample_VST3.vcxproj]

Am I missing some .h? Or what’s going bad?

Thanks for any helps :slight_smile:

You probably need to add the juce_dsp module to your project. If you’re using CMake, that means adding juce_dsp to your target_link_libraries call.

1 Like

Works! Thanks @reuk, very kind!

@reuk: maybe you can help me further.

On the JUCE doc tutorial, for the prepare method, it show this code:

void prepare (const juce::dsp::ProcessSpec& spec)
	tempBlock = juce::dsp::AudioBlock<float> (heapBlock, spec.numChannels, spec.maximumBlockSize);
	processorChain.prepare (spec);

	lfo.prepare ({ spec.sampleRate / lfoUpdateRate, spec.maximumBlockSize, spec.numChannels }); // [4]

But on the class PluginProcessor.cpp, I don’t have that prepare function, and can’t see any override :open_mouth:

I’ve only this:

void AudioPluginAudioProcessor::prepareToPlay(double sampleRate, int samplesPerBlock)
    // Use this method as the place to do any pre-playback
    // initialisation that you need..
    juce::ignoreUnused(sampleRate, samplesPerBlock);

Which doesn’t contain the whole var I need (i.e. maximumBlockSize, numChannels).
It seems I’m doing it wrong :slight_smile:

In fact, this seems a bit weird:

lfo.prepare({sampleRate / lfoUpdateRate, (unsigned int)samplesPerBlock, 2});

Missing somethings?

The tutorial is a bit ambiguous, but prepare is a different function from prepareToPlay. The prepare function is a member of the Voice class. It isn’t an overriding function.

1 Like