I am currently trying to move my code from mbedOS 5.15.3 to 6 and run into a weird error while compiling when a class name includes inheritance. I am using GCC_ARM on a nrf52840 target.
If I define a class under mbedOS 5.15.3/4 the following way:
class CLASSNAME : public OBJECT_TO_INHERIT { …
}
it works just great while under mbedOS 6 I am getting a compiling error:
expected class-name before ‘{’ token
Is this a know issue (I couldn´t find any in the release notes) or am I missing something here?
Could you post the concrete names of your class and the class which is inherited? From my experience there might be a name clash with some other Mbed classes.
Hi Andreas, thank you for your response to my question. I could isolate the issues to a custom usage of Segger RTT. The classes resulting in compiling errors are as following:
#include “SEGGER_RTT.h”
Header: class SRTTOUT : public Stream
cpp: SRTTOUT::SRTTOUT(const char *name) : Stream(name)
Header: class SRTTMBEDConsole : public FileHandle {}
cpp: FileHandle *mbed::mbed_override_console(int fd)
As mentioned - the implementation worked great from 5.13 to 5.15.4 but in 6.0 I am seeing errors.
Hm, you want to derive from Stream, and the error message says that there is no class name befor ‘{’.
Maybe in former versions of Mbed OS the header Stream.h was included in some other include file, and now its not. You could try to add a
#include "Stream.h"
or
#include "platform/Stream.h"
somewhere on top of the failing file.
Just a guess…