SOLVED [Adafruit GFX lib] Fonts library doesnt work out side of main.cpp

Hi, Adafruit GFX lib Fonts do not have any effect when I separate the object code from the main code.

However, if I keep the same code inside main, everything is fine.

Any ideas?

I have no idea what you mean. What is “doesn’t work” exactly? Any error message? What is the “object code”? (I guess you don’t mean .o intermediate object files) What’s the exact platformio.ini and code?

Thanks for response @maxgerhardt
Yup, is hard to understand this. With doesnt work I mean a rare behaivor of the library with the use of same fonts either one single code file and separate code files into main.cpp, Display.cpp and Display.h.
By object I mean the class code separated from the main.cpp. No object files that the compiler handles.
I dont get errors messages. The display does not receive the order setfont if it is called from a class.

Both projects have the same platformio.ini


And here the two projects.

In the constructor of the Display class you don’t initialize the pantalla member variable properly – instead you just create a new variable in the scope of the constructor with the same name. You need to use constructor initializer lists here.

Display::Display() : pantalla(SCREEN_WIDTH, SCREEN_HEIGHT)

Thank you @maxgerhardt.
I need to read a bit more about initializer list.