[solved] Struct in extern const variable

Hello everyone,

I am puzzled by the following situation. I try to use my own Debuggerfunctions using the same style as in HardwareSerial.h, but somehow the compiler does not like my approach

Localdebugger.h

#ifndef H_DEBUGGER_LOCAL
#define H_DEBUGGER_LOCAL

#include <Arduino.h>

typedef struct Timer {
  bool SET;
  float DELAY;
  int COUNT;
  int pos;
  //
  Timer() {}

  void setTimer(float delay, float looptime) {
    COUNT = delay/looptime;
    SET = true; pos = 0;
  }

  bool time() {
    if(pos>=COUNT) {
      flush();
      return true;
    }

    pos++;
    return false;
  }

  void flush() {
    SET = false; pos=0;
  }
};

class Debugger {

public:

  const byte CONTINUE = 'c';
  const byte ESCPAE = 'e';

  Timer TIMER = Timer();

void setTimer(float delay, float looptime) const {
  TIMER.setTimer(delay,looptime);
}

};

extern const Debugger Debug;

#endif

main.cpp

#include <Arduino.h>

#include "Debugger_Local.h"

void setup() {

    Debug.setTimer(100,10);
}

void loop() {
    Serial.println("Loop");


    delay(2500);
}

For some reason this is not allowed. I also do not get a detailed error message

Linking .pioenvs/uno/firmware.elf
/tmp/ccvmRNtp.ltrans0.ltrans.o: In function `main':
<artificial>:(.text.startup+0x9e): undefined reference to `Debug'

I also get a warning which might indicate the problem, but I dont understand it

src/Debugger_Local.h:44:32: warning: passing 'const Timer' as 'this' argument discards qualifiers [-fpermissive]
TIMER.setTimer(delay,looptime);

Thanks for the help.

EDIT: I had a similar problem already. Of course the compiler does not see Debug, because it is not yet defined for this const variable

Creating a constructor

Debugger() {}

and calling it at the end using

extern const Debugger Debug = Debugger();

solved it.

Sorry for the inconvenience.