Hey, I am currently having trouble getting the debug build working.
I am getting undefined reference to
vtable for Effect’` as error from the linker.
But when I build it with build_type release the error disappears.
I have seen many workarounds with not using an inline destructor. But that just simply is not working for me.
Complete error:
Linking .pio\build\dev-lamp\firmware.elf
.pio\build\dev-lamp\src\effects\BasicEffect.cpp.o:(.literal._ZN11BasicEffectD2Ev+0x0): undefined reference to `vtable for Effect'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\dev-lamp\firmware.elf] Error 1
I have several child classes that implement the Effect class and only the BasicEffect class has problems while linking with build_typ = debug.
Effect.h:
#pragma once
#include <Constants.h>
#include <FastLED.h>
class Lamp;
class Effect
{
private:
Lamp * lamp;/* data */
bool needsSpectrum = false;
public:
Effect(Lamp* owner) {
lamp = owner;
};
virtual ~Effect() {};
Lamp * getLamp() {
return lamp;
};
bool getNeedsSpectrum() {
return needsSpectrum;
}
void setNeedsSpectrum(bool newValue) {
needsSpectrum = newValue;
}
virtual void run();
};
BasicEffect.h
#pragma once
#include "effects/Effect.h"
class BasicEffect : public Effect
{
private:
/* data */
public:
BasicEffect(Lamp* owner) : Effect(owner) {
};
void run();
//Destuctor
~BasicEffect();
};
BasicEffect.cpp
#include "effects/BasicEffect.h"
#include <Lamp.h>
static const char* TAG = "BaiscEffectModule";
BasicEffect::~BasicEffect() {
}
void BasicEffect::run() {
Lamp* lamp = getLamp();
if (lamp->getPatternMode())
{
fill_palette(lamp->getLeds(), NUM_LEDS, lamp->getTransformingCounter(), lamp->getZoom(), *lamp->getObjPalette(), lamp->getBrightness(), LINEARBLEND);
}
else
{
fill_solid(lamp->getLeds(), NUM_LEDS, lamp->getCrntColor());
}
if (lamp->getEffect() == 6)
{
FastLED.setBrightness(dim8_raw(scale8(lamp->getMappedMSGEQ7(2), lamp->getBrightness())));
}
else
{
FastLED.setBrightness(lamp->getBrightness());
}
FastLED.show();
}
Normaly i wouldnt mind this and just keep using the build_typ = release but since i want to get the JTAG debugger working for my ESP32 in this project it seems like i need to take care of this error befor I can start the JTAG.