You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When there are two cpp files present that include the ReactiveArduinoLib.h file, linking breaks.
This is probably caused because not all the definitions are templates but do generate code.
Looks like this is caused by the Serial Observables.
Project to reproduce in PlatformIO is attached.
Linking .pio/build/esp32dev/firmware.elf
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<unsigned char>::Suscribe(IObserver<unsigned char>&)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:30: multiple definition of ObservableSerial::Suscribe(IObserver&)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:30: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<char>::Suscribe(IObserver<char>&)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:30: multiple definition of ObservableSerial::Suscribe(IObserver&)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:30: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<String>::Suscribe(IObserver<String>&)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:33: multiple definition of ObservableSerial::Suscribe(IObserver&)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:33: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<int>::Suscribe(IObserver<int>&)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:35: multiple definition of ObservableSerial::Suscribe(IObserver&)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:35: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<float>::Suscribe(IObserver<float>&)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:42: multiple definition of ObservableSerial::Suscribe(IObserver&)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:42: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<double>::Suscribe(IObserver<double>&)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:42: multiple definition of ObservableSerial::Suscribe(IObserver&)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:42: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<unsigned char>::ObservableSerial()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:25: multiple definition of ObservableSerial::ObservableSerial()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:25: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<unsigned char>::ObservableSerial()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:25: multiple definition of ObservableSerial::ObservableSerial()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:25: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<char>::ObservableSerial()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:25: multiple definition of ObservableSerial::ObservableSerial()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:25: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<char>::ObservableSerial()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:25: multiple definition of ObservableSerial::ObservableSerial()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:25: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<String>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:27: multiple definition of ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:27: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<String>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:27: multiple definition of ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:27: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<int>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:29: multiple definition of ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:29: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<int>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:29: multiple definition of ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:29: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<float>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:36: multiple definition of ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:36: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<float>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:36: multiple definition of ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:36: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<double>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:36: multiple definition of ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:36: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<double>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:36: multiple definition of ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:36: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<unsigned char>::Receive()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:35: multiple definition of ObservableSerial::Receive()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:35: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<char>::Receive()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:35: multiple definition of ObservableSerial::Receive()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:35: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<String>::Receive()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:38: multiple definition of ObservableSerial::Receive()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:38: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<int>::Receive()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:40: multiple definition of ObservableSerial::Receive()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:40: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<float>::Receive()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:47: multiple definition of ObservableSerial::Receive()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:47: first defined here
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function ObservableSerial<double>::Receive()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:47: multiple definition of ObservableSerial::Receive()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:47: first defined here
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32dev/firmware.elf] Error 1
The text was updated successfully, but these errors were encountered:
Is solved by using inline so they the functions are not emitted by the header files. Saves memory if not used and possibility to include the files multiple times. See PR
When there are two cpp files present that include the ReactiveArduinoLib.h file, linking breaks.
This is probably caused because not all the definitions are templates but do generate code.
Looks like this is caused by the Serial Observables.
Project to reproduce in PlatformIO is attached.
Archive.zip
Linking .pio/build/esp32dev/firmware.elf
/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<unsigned char>::Suscribe(IObserver<unsigned char>&)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:30: multiple definition of
ObservableSerial::Suscribe(IObserver&)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:30: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<char>::Suscribe(IObserver<char>&)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:30: multiple definition of
ObservableSerial::Suscribe(IObserver&)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:30: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<String>::Suscribe(IObserver<String>&)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:33: multiple definition of
ObservableSerial::Suscribe(IObserver&)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:33: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<int>::Suscribe(IObserver<int>&)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:35: multiple definition of
ObservableSerial::Suscribe(IObserver&)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:35: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<float>::Suscribe(IObserver<float>&)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:42: multiple definition of
ObservableSerial::Suscribe(IObserver&)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:42: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<double>::Suscribe(IObserver<double>&)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:42: multiple definition of
ObservableSerial::Suscribe(IObserver&)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:42: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<unsigned char>::ObservableSerial()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:25: multiple definition of
ObservableSerial::ObservableSerial()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:25: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<unsigned char>::ObservableSerial()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:25: multiple definition of
ObservableSerial::ObservableSerial()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:25: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<char>::ObservableSerial()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:25: multiple definition of
ObservableSerial::ObservableSerial()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:25: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<char>::ObservableSerial()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:25: multiple definition of
ObservableSerial::ObservableSerial()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:25: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<String>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:27: multiple definition of
ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:27: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<String>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:27: multiple definition of
ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:27: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<int>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:29: multiple definition of
ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:29: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<int>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:29: multiple definition of
ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:29: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<float>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:36: multiple definition of
ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:36: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<float>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:36: multiple definition of
ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:36: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<double>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:36: multiple definition of
ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:36: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<double>::ObservableSerial(char)': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:36: multiple definition of
ObservableSerial::ObservableSerial(char)'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:36: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<unsigned char>::Receive()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:35: multiple definition of
ObservableSerial::Receive()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialByte.h:35: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<char>::Receive()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:35: multiple definition of
ObservableSerial::Receive()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialChar.h:35: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<String>::Receive()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:38: multiple definition of
ObservableSerial::Receive()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialString.h:38: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<int>::Receive()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:40: multiple definition of
ObservableSerial::Receive()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialInteger.h:40: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<float>::Receive()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:47: multiple definition of
ObservableSerial::Receive()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialFloat.h:47: first defined here/pio/build/esp32dev/src/screen_connecting.cpp.o: in function
ObservableSerial<double>::Receive()': ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:47: multiple definition of
ObservableSerial::Receive()'; .pio/build/esp32dev/src/main.cpp.o:ibdeps/esp32dev/ReactiveArduino/src/Observables/ObservableSerialDouble.h:47: first defined herecollect2: error: ld returned 1 exit status
*** [.pio/build/esp32dev/firmware.elf] Error 1
The text was updated successfully, but these errors were encountered: