[sdiy] OT (but very synthy): C question
Eric Brombaugh
ebrombaugh1 at cox.net
Tue Mar 29 16:01:37 CEST 2011
It sounds like your issue is one of circular definitions - a contains b and b contains a, so there's no place the parser can start that doesn't leave something undefined. Seems to me the right thing to do is break the include files up into finer grains - define low level stuff first in separate files, then build on those with additional definitions in later files.
Or give up and use void pointers.
Eric
On Mar 29, 2011, at 6:41 AM, Tom Wiltshire wrote:
> For example, think what happens when LFO.h includes MIDI.h and vice versa.
>
> Let's assume LFO.h is loaded first. It isn't defined yet, so it gets #defined, and then we come to the includes, midi.h. That gets fed in, since it isn't defined yet either. It includes LFO.h, which is ignored since it is already defined. All fine so far.
> Until we get to halfway down midi.h, where there's a reference to an LFO structure which hasn't been set up, since we got to this point from the include statement way back at the beginning of LFO.h
>
> So I don't see how the inclusion guards actually help at all.
>
> I'm still trying to get the forward declarations to work instead, but somehow it keeps chucking syntax errors. I've set up a new project with the same layout and structures, but very stripped down code so that I've got a simple place to test things. Once I get it working there, I'll take my new understanding back t the actual project.
More information about the Synth-diy
mailing list