10 years, 6 months ago.

Error with including mbed objects into class

Hi i wrote a class and wanted to add a BusOut object. But when I try to compile the program there are some errors occuring:

Error: No default constructor exists for class "mbed::BusOut" in "main.cpp", Line: 17, Col: 18 Error: No default constructor exists for class "mbed::BusOut" in "main.cpp", Line: 17, Col: 18

Heres my class:

class display{ private: int width; int height; public: display(); BusOut coloumns; BusOut rows; };

display::display(){ this->width = 5; this->height = 7; }

I want to assign some portpins to the bus in the display::display constructor. I know that the portpins are currently missing but the error has to be solved first. What do I have to do to include mbed objects into classes?

all the best and thank you for your attention

1 Answer

10 years, 6 months ago.

Use code tags please (<<code>> and <</code>>)

The error is because you don't assign portpins to the bus: It cannot make those BusOut objects because no pins are assigned to them. See for example here: http://mbed.org/users/simon/code/TextLCD/docs/44f34c09bd37//TextLCD_8cpp_source.html, how to make sure they get pins (in that example they get pins from the constructors arguments, but you can also fix it for testing).