I’m still learning how to use Juce, and what I did was to start from the Juce demo.
Let’s say I want to implement a class that process a stream of audio.
Eventually, I want to write a class which inherits the class AudioSource, as e.g. IIRFilterAudioSource.
But for now, I just use a copy of IIRFilterAudioSource, rename all members, include this in my project.
Everything compiles nicely, but does not link: symbols not found.
Any idea why this does happen?
In your project, add the source file: juce_amalgamated.cpp
then # inclue <juce_amalgamated.h> in every cpp…
Hope to help you solve the problem.
yes, I have these included: JuceHeader.h includes the amalgamated header, and the cpp are “included” via JuceLibraryCode.mm, it’s all there from the Juce demo project.
And everything worked fine - until I include a copy of IIRFilterAudioSource, all members renamed.
I include this, it compiles, but gives the linker error.
If I include any of my classes, it links.
It must be something specific to objective C, maybe? But I have no experience with objective C.
But something like “the symbol names are different if the code comes from the amalgamated sources”?
Unfortunately I don’t know where to look for the symbol names, which the compile generates. I did no coding for quite some time, and my knowledge of XCode is very limited.
To be a bit more clear:
The linker error comes when I do this
m_process = new SpecProcAudioSource(&transportSource , 0);
to make an instance of a class which inherits AudioSource.
If I do the same with e.g. the class IIRFilterAudioSource, it works.
It does not with my class.
“SpecProcAudioSource::SpecProcAudioSource(juce::AudioSource*, bool)”, referenced from:
ld: symbol(s) not found
collect2: ld returned 1 exit status
As far as I understand, it won’t link as soon as you use your self-written classes. It seems that you have a constructor SpecProcAudioSource(juce::AudioSource*, bool) declared but not defined since ld can’t find it but you don’t get any compiler errors. Maybe you just have to add another cpp file containing this class to your project.
I have implemented the constructor and it is is included (and visible) in the project.
It’s not defined (as the linker says), but I can’t see why.
maybe the problems is where I make the instance of my class.
I tried it like this
SpecProcAudioSource m_process(AudioSource* , bool);
but when doing
it fails to compile, with this error
AudioDemoSpecProcPage.cpp:205: error: no matching function for call to ‘juce::AudioSourcePlayer::setSource()’
this does compile but gives the linker error:
I have the feeling that this problem has something to do with having the code in my cpp-file wrapped in
Does this make sense?
Looking at the object files, the objets in myclass.o are named
In the object file of the class which uses myclass (and is responsible for the linker error), it has symbols
Does this give a hint to a solution?
ok, this was a problem with a namespace.