Closed barneyz closed 4 years ago
I can't reproduce it any more, but I don't know why the error is gone.
This occurs with every library , when a library is updated and the last compile process in the project is younger than the library source file dates. In this case the build process will never compile the new library code! You must find and delete every library-code .o and .d files
I change to new 2.4.5 library for fixing the color strip color "white" problem switches the strip off, but i get linker errors with the new definition of callbacks in the library:
Compiling 'ESP32_Schrank' for 'WEMOS LOLIN32' Error linking for board WEMOS LOLIN32 ESP32_Schrank.cpp.o: (.literal._Z5setupv+0x4c): undefined reference to EspalexaDevice::EspalexaDevice(String, std::function<void (unsigned char)>, unsigned char) Build failed for project 'ESP32_Schrank' ESP32_Schrank.cpp.o: (.literal._Z5setupv+0x50): undefined reference to EspalexaDevice::EspalexaDevice(String, std::function<void (unsigned char, unsigned int)>, unsigned char)
ESP32_Schrank.cpp.o: In function setup() ESP32_Schrank.ino:651: undefined reference to EspalexaDevice EspalexaDevice(String, std function<void (unsigned char)>, unsigned char) ESP32_Schrank.ino:652: undefined reference to EspalexaDevice EspalexaDevice(String, std function<void (unsigned char, unsigned int)>, unsigned char) ESP32_Schrank.ino:653: undefined reference to EspalexaDevice EspalexaDevice(String, std function<void (unsigned char)>, unsigned char) ESP32_Schrank.ino:654: undefined reference to EspalexaDevice EspalexaDevice(String, std function<void (unsigned char, unsigned int)>, unsigned char) collect2.exe*: error: ld returned 1 exit status
My setup routine contains the lines 651 to 654: device[0] = new EspalexaDevice(alexatext[0], s0_Callback); device[1] = new EspalexaDevice(alexatext[1], s1_Callback); device[2] = new EspalexaDevice(alexatext[2], s2_Callback); device[3] = new EspalexaDevice(alexatext[3], s3_Callback);
and the callbacks are defined as
void s0_Callback(uint8_t brightness)
void s1_Callback(uint8_t brightness, uint32_t rgb) void s2_Callback(uint8_t brightness) void s3_Callback(uint8_t brightness, uint32_t rgb)
I have no idea for fixing this linker errors.
Edit:
Changing back in 2.4.5 //typedef std::function<void(uint8_t b)> BrightnessCallbackFunction; //typedef std::function<void(EspalexaDevice d)> DeviceCallbackFunction; //typedef std::function<void(uint8_t br, uint32_t col)> ColorCallbackFunction; typedef void (BrightnessCallbackFunction) (uint8_t b); typedef void (DeviceCallbackFunction) (EspalexaDevice d); typedef void (*ColorCallbackFunction) (uint8_t br, uint32_t col); there are no errors.