Need help with collect2.exe: error: ld returned 1 exit status

Hi guys.
I want to rewrite one of my projects I’m working on. Currently, I’m working on including all the libraries and dependencies as well as creating the framework of my main file.
I have an error I can’t figure out, maybe one of you can help me.
There isn’t much in the code yet, so it shouldn’t be too hard to understand. For now, there are mainly ISR’s and some library initializations.
I think the problem has to do with one of the libraries. I’m trying to create two instances of the stled316s library and I don’t know if that’s possible. It should, but I don’t know for certain.
My Project File is uploaded here: https://drive.google.com/drive/folders/1Oaq8JnqTEabo8DXKpcsVWi9zLNnhO1k9?usp=sharing
Error Message:

The problem here is with virtual functions in the inheritance relationship between the 3 STLED classes in the STLED316S library.

According to c++ - Undefined reference to vtable - Stack Overflow I tried some things out and found that if I change

to

		virtual void writeData(uint8_t *data, uint8_t lenght) = 0;
		virtual uint8_t readData(uint8_t address) = 0;

aka, make it a pure virtual function in the base class, then compilation works.

RAM:   [          ]   4.4% (used 14256 bytes from 327680 bytes)
Flash: [==        ]  16.9% (used 221530 bytes from 1310720 bytes)
Building .pio\build\esp32doit-devkit-v1\firmware.bin
esptool.py v3.0
======================== [SUCCESS] Took 7.47 seconds ========================

You can try this fork of the library by changing the lib_deps expression in your project’s platformio.ini to

lib_deps = 
	erropix/ESP32 AnalogWrite@^0.2
	fastled/FastLED@^3.4.0
	madhephaestus/ESP32Servo@^0.9.0
	https://github.com/maxgerhardt/STLED316S.git
	ellsclytn/Rotary@0.0.0-alpha+sha.d1fef10209

this may have also something to do with a compiler upgrade…

I don’t have the hardware to test if this is working so you need to test that, but it compiles.

Thank you so much for your very detailed help. Still waiting for the STLED316S chips, I’ll try it and report back as soon as they are here.

1 Like