to create an array of 10 filters. Then in constructor I will do:
IIR[x] = new IIRFilter();
Compiling in windows, studio 2012. The ide does not complain showing no syntax errors. Hovering the mouse over IIRFilter in the declaration it says it is clasee juce:IIRFilter.
But when I compile it complains that there is is a syntax error :’ missing ‘;’ before IIR. Next it says missing type specifier - int assumed. Then IIR undeclared identifier.
I don’t understand what is wrong. I tried to specify the IIRFilter.h header file, I tried to declare class IIRFilter. A search for IIRFilter in my solution files the source for it so the project must be including needed files.[/quote]
A few things:
One is that an array of loose pointers like that is a big no-no in modern C++ and Juce. Use an OwnedArray, for example, or since you seem to be pre-allocating, make them on the heap, not with pointers.
Next, probably a typo, but you have the wrong bracket in your declaration.
Also - check the line before your declaration. Does it have a ‘;’? Remember that a class definition needs a semi-colon after it. Or is there an included file that is missing a semi-colon at the end?
So - the meat is that the IDE and the compiler really don’t talk. The fact that the IDE says your syntax is fine, and you can look-up methods doesn’t help the compiler. The compiler uses the code you’ve given it, often by including as .h file. (You can think of that as appending the whole .h file at the head of your .cpp file).
When you say “specify the IIRFilter.h header file” it makes me want to ask (since that’s not the usual lingo) - do you have a line like
#include "IIRFilter.h" in your .cpp file? Your attempt to declare the class is something different - that sort of pre-definition used to deal with the order of inclusion generally, so that two classes declared in the same header file could reference each other.
What may be happening is that your compiler can’t find the header file. Check your include paths - that’s the possible locations each compilation action is given to find the files.
Also - it would be more usual to see a inclusion of some sort of juce_header.h file that pulls in all the juce classes. Why are you just trying to include that one file?