"is implicitly deleted because the default definition would be ill-formed:"

Status
Not open for further replies.

Gripporillat

Well-known member
Hi everybody,

while trying to construct an object of a class of mine I get this error message:

Arduino: 1.8.8 (Windows 10), TD: 1.45, Board: "Teensy 3.5, MIDI, 120 MHz, Faster, US English"

SkyController: In function 'void construct(Device)':
SkyController:36: error: use of deleted function 'SkyFlash& SkyFlash::eek:perator=(const SkyFlash&)'
flashes[thisdevice.mpxpin_flash-1][inputsonchannel[thisdevice.mpxpin_flash-1][2]] = SkyFlash(potis[thisdevice.mpxpin-1][inputsonchannel[thisdevice.mpxpin-1][thisdevice.type]], thisdevice.teensypin_flash);

^

...\SkyController/SkyController.h:5:0,

...\SkyController.ino:2:

E:\Dropbox\Paraluna\Entwicklung Skycommander\Contollerboard\Teensy\Sketches\libraries\SkyController/SkyFlash.h:11:7: note: 'SkyFlash& SkyFlash::eek:perator=(const SkyFlash&)' is implicitly deleted because the default definition would be ill-formed:

class SkyFlash {

^

...\libraries\SkyController/SkyFlash.h:11:7: error: non-static reference member 'SkyPoti& SkyFlash::poti', can't use default assignment operator

SkyController: In function 'void setup()':
SkyController:51: warning: unused variable 'devices'
Device devices[numberofdevices];

^

use of deleted function 'SkyFlash& SkyFlash::eek:perator=(const SkyFlash&)'

There seems to be a problem with the default Constructor of my Class. But unfortunately I don't get it.

This is the header:

Code:
#ifndef SkyFlash_h
#define SkyFlash_h



#include "Arduino.h"
#include "SkyPoti.h"
#include "Bounce.h"


class SkyFlash {
  public:
	SkyFlash();
	SkyFlash(SkyPoti& Poti, int pin);
	~SkyFlash();
    void send();
  private:
	SkyPoti& poti;
	Bounce bounce;

    
};


#endif

cpp:

Code:
#include "Arduino.h"
#include "SkyFlash.h"
#include "SkyPoti.h"
#include "Bounce.h"

SkyPoti defaultpoti;

//default Constructor
SkyFlash::SkyFlash(): poti(defaultpoti), bounce(0, 0) {
}

//Constructor
SkyFlash::SkyFlash(SkyPoti& Poti, int pin) : poti(Poti), bounce(pin, 10) {
	pinMode(pin, INPUT_PULLUP);
	
}

//Destructor
SkyFlash::~Skyflash() {

}

//flash that thing!
void SkyFlash::send() {
	bounce.update();
	if (bounce.fallingEdge()) {
		poti.flash(true);
	}	else  if (bounce.risingEdge()) {
		poti.flash(false);
	}
}

Attached you'll find the whole code including ino and library.

Thank you in advance, I'm sorry for all that code, but I don't know how I could provide a simpler example of this problem.
 

Attachments

  • SkyController.zip
    4 KB · Views: 150
The default operator=() is deleted because you have reference as a member (SkyPito& poti). Either write your code so that it doesn't require operator=() or change the member to pointer for example. You just need to make sure that even in that case the default copy behavior is correct (e.g. you don't double-delete poti upon destruction, etc.)
 
Status
Not open for further replies.
Back
Top