I’m not sure if this is a bug, but the mbed cloud compiler doesn’t like this code because the Serial object is a member of the class.
class device {
public:
void send();
private:
Serial serial(p9, p10);
};
Is there a workaround for this? Every other C++ compiler I’ve used supports putting objects inside of classes, so I don’t see why the mbed's should be any different.
Edit: Here are the errors it gives when it hits the line Serial serial(p9, p10);
:
- constant “p9” is not a type name
- constant “p9” is not a type name
And here are the errors it gives when you try to access serial
from a member function of the class device; for example, serial.printf(“Hello”);
:
- nonstandard form for taking the address of a member function
- expression must have a class type
I’m not sure if this is a bug, but the mbed cloud compiler doesn’t like this code because the Serial object is a member of the class.
Is there a workaround for this? Every other C++ compiler I’ve used supports putting objects inside of classes, so I don’t see why the mbed's should be any different.
Edit: Here are the errors it gives when it hits the line
Serial serial(p9, p10);
:And here are the errors it gives when you try to access
serial
from a member function of the class device; for example,serial.printf(“Hello”);
: