On May 9, 2005, at 10:07 AM, Bruce Coughlin wrote:
This might be a CW problem but perhaps the error msg will give a clue as to how I can fix this:
I'm having trouble compiling myMacHeaders with CW 9.5 under OS 10.4. I get
the following error msg:
Error : types that are declared in parameter lists ('ScheduledAudioSlice')
go out of scope at the end of the function declaration/definition,
this is probably not what you want (maybe use a forward declaration?)
(included from:
AudioUnit/AudioUnit.h:26
AudioToolbox/AUGraph.h:73
myMacHeaders9Mach-O.c:50
MSL MacHeadersMach-O.pch:23)
AudioUnitProperties.h line 1128 struct ScheduledAudioSlice *bufferList);
You typically see this warning in C++ (odd, since you said it was for C) because, technically speaking, the "implicit name spaces" (I'm making that term up) of the following two declarations are different for the ScheduledAudioSlice structure. When a "struct Blah" parameter is implicitly declared in a function prototype, it has a different signature than it would if it had been previously forward-declared.
struct ScheduledAudioSlice;
typedef void (*ScheduledAudioSliceCompletionProc)(void *userData,
struct ScheduledAudioSlice *bufferList);
vs.
typedef void (*ScheduledAudioSliceCompletionProc)(void *userData,
struct ScheduledAudioSlice *bufferList);
The compiler is telling you that there is a distinction and that forward declaring struct ScheduledAudioSlice would fix it.
The pre-9.4 CW compiler would ignore these but the 9.4 compiler and beyond became more strict. gcc already issues this warning so in this case CW has become more like gcc.
This compiled fine under 10.3 and CW 9.4.
I've installed (and re-installed) the CoreAudioSDK from the Tiger 10.4 CD (Xtools folder).
The C++ version compiles fine. It's the plain C version I'm having trouble with.
Which is bizarre b/c I think only C++ should make the distinction. Also odd since I think it was the 9.4 compiler that first started warning about these things. ???
I realize I didn't help much but that at least should explain the *normal* reasons you would see that warning. :-)