Linker problem with source file

Hi,
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.
Hm.
Any idea why this does happen?
Best,
Chris

Simpler method:

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.

thanks, SwingCoder
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:
AudioDemoSpecProcPage::AudioDemoSpecProcPage(juce::AudioDeviceManager&)in AudioDemoSpecProcPage.o
AudioDemoSpecProcPage::AudioDemoSpecProcPage(juce::AudioDeviceManager&)in AudioDemoSpecProcPage.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Any ideas?

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.

Chris

thanks,
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
audioSourcePlayer.setSource (m_process);

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:
ScopedPointer m_process;

I have the feeling that this problem has something to do with having the code in my cpp-file wrapped in

BEGIN_JUCE_NAMESPACE

END_JUCE_NAMESPACE

Does this make sense?
Hm.

Looking at the object files, the objets in myclass.o are named
juce::myclass

In the object file of the class which uses myclass (and is responsible for the linker error), it has symbols
myclass

Does this give a hint to a solution?
Thanks

ok, this was a problem with a namespace.
Cheers