Undefined symbols for architecture arm64 while compliing

I am pretty new to C++ and have some issues understanding this error message

[build] Undefined symbols for architecture arm64:
[build] “juce::dsp::IIR::Coefficients::Coefficients(float, float, float, float)”, referenced from:
[build] juce::dsp::IIR::Filter::Filter() in libJoba_SharedCode.a(PluginProcessor.cpp.o)
[build] “juce::dsp::IIR::Coefficients::getFilterOrder() const”, referenced from:
[build] juce::dsp::IIR::Filter::reset(float) in libJoba_SharedCode.a(PluginProcessor.cpp.o)
[build] ld: symbol(s) not found for architecture arm64
[build] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[build] make[3]: *** [CreateLikeJay_artefacts/Debug/Standalone/Joba.app/Contents/MacOS/Joba] Error 1
[build] make[2]: *** [CMakeFiles/CreateLikeJay_Standalone.dir/all] Error 2
[build] make[1]: *** [CMakeFiles/CreateLikeJay_Standalone.dir/rule] Error 2
[build] make: *** [CreateLikeJay_Standalone] Error 2

I narrowed it down through some debugging and figured out its coming from somewhere here

private:
using Filter = juce::dsp::IIR::Filter;
using CutFilter = juce::dsp::ProcessorChain<Filter, Filter, Filter, Filter>;
using MonoChain = juce::dsp::ProcessorChain<CutFilter, Filter, CutFilter>;
MonoChain leftChain, rightChain;

And Probably how i am declaring leftChain and rightChain here

void AudioPluginAudioProcessor::prepareToPlay(double sampleRate, int samplesPerBlock)
{
// Use this method as the place to do any pre-playback
// initialisation that you need…
juce::dsp::ProcessSpec spec;
spec.maximumBlockSize = samplesPerBlock;
spec.numChannels = 1;
spec.sampleRate = sampleRate;
leftChain.prepare(spec);
rightChain.prepare(spec);
juce::ignoreUnused(sampleRate, samplesPerBlock);
}

any ideas?

You probably need to add the juce_dsp module to your project. If you’re using the Projucer, you can do this from the ‘modules’ panel on the left side of the screen.

1 Like

I’m using vscode and I believe I already had juce_dsp included at the top of my module like so

#include <juce_dsp/juce_dsp.h>

I even tried to specify the exact directories for the IIR modules and received errors basically stating that I was including it twice.

The errors arise the moment I add the leftChain & rightChain variables

This is not an #include problem, but a linking problem. Try the Projucer and it should work.

Are there any references that I can use if I’m not using Projucer? It’s not an viable option for me on my current device unfortunately and my current build is through CMake & VSCode. What do you mean exactly when you say linking issue?

CMake is supported. See for example examples/CMake/ in the JUCE distribution, and/or

You might also create a new project in Projucer and look at what it writes in the JuceLibraryCode directory. Maybe use the Linux Makefile exporter to see how it links in the Makefile.

Basically, in addition to including the header files, you need to compile the .cpp files and link the resulting .o files into your executable (using ld or equivalent). All of the above examples will illustrate that.

1 Like

If you’re using the CMake support provided by JUCE, you need to add juce_dsp to your target_link_libraries call.

1 Like

Thank you @jos-ccrma for the references! I looked through the examples and they are good guides for troubleshooting while I maneuver through my project.

@reuk that was it! I forgot about the CMakeList file after setting it up, but it seems like a good first step to look at for troubleshooting (as well as the CMake API Module). Thank you!