Error c218: Unknown class/interface '%'


When this compiler error occurs it is often surprising to the programmer. The reason is that the IDE does what it can to protect you from this problem.

When you write:

class xxx : inputStream

the interface inputStream must be known. If it is not known you will receive the mentioned error.

The interface is known if the file that defines this interface is included by the pack file that is being compiled. Very often you don't have to worry about include directives, because the IDE inserts them automatically for you (the behaviour is controlled by a setting in the IDE). If the relevant interface has been met in the project (during compilation), the IDE knows which include directive to insert to make the interface known. So the IDE inserts the include directive and re-compiles the relevant pack file. The error disappears and you will not see it at all.

If however the interface has not been met at all the IDE does not know which include directive to insert and the error will remain. And this is the situation in which you will see the error message. This is where you might ask yourself: "I have written like this many times before, and that never gave such a problem. So why now?"

There are two ways to get rid of the error:

  1. Either you type in the include directive yourself in the relevant place
  2. Or you add the package that contains the interface/class and compile again, because then the interface/class is suddenly known and the IDE will insert the include directive.