Hey,
I am curently working on a Arduino (ESP 8266) programm that requerers the use of an abstract class that has a number of child classes. so far everything is working completly, but the main file is very convolutet. so i wantet to spit the file into ist classes. for this i thought i need to make a new .cpp file that links to the .h file that ist already there. but as soon as i even write a simple “Include Header1.h” statment in this new file i get lots and lots of erros in the linkin prozess that more or less point to the abstract class. If i try compiling with only one cpp and one .h file everything works perfectly fine. The .h file is protectet angainst multipel incusion.
PlatformIO core:5.1.1 Home 3.3.4 ESP8266 3.1.0
the error i get is this:
Linking .pio\build\nodemcu\firmware.elf
c:/users/fixiw/.platformio/packages/toolchain-xtensa/bin/…/lib/gcc/xtensa-lx106-elf/10.3.0/…/…/…/…/xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcu\src\main.cpp.o: in function _ZN13LED_InterfaceD2Ev': main.cpp:(.text._ZN13LED_InterfaceD2Ev+0x0): multiple definition of
_ZN13LED_InterfaceD2Ev’; .pio\build\nodemcu\src\LED_snkae_one_collor.cpp.o:LED_snkae_one_collor.cpp:(.text._ZN13LED_InterfaceD2Ev+0x0): first defined here
c:/users/fixiw/.platformio/packages/toolchain-xtensa/bin/…/lib/gcc/xtensa-lx106-elf/10.3.0/…/…/…/…/xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcu\src\main.cpp.o: in function _ZN13LED_InterfaceD2Ev': main.cpp:(.text._ZN13LED_InterfaceD2Ev+0x0): multiple definition of
_ZN13LED_InterfaceD1Ev’; .pio\build\nodemcu\src\LED_snkae_one_collor.cpp.o:LED_snkae_one_collor.cpp:(.text._ZN13LED_InterfaceD2Ev+0x0): first defined here
c:/users/fixiw/.platformio/packages/toolchain-xtensa/bin/…/lib/gcc/xtensa-lx106-elf/10.3.0/…/…/…/…/xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcu\src\main.cpp.o: in function _ZN13LED_InterfaceD0Ev': main.cpp:(.text._ZN13LED_InterfaceD0Ev+0x4): multiple definition of
_ZN13LED_InterfaceD0Ev’; .pio\build\nodemcu\src\LED_snkae_one_collor.cpp.o:LED_snkae_one_collor.cpp:(.text._ZN13LED_InterfaceD0Ev+0x4): first defined here
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\nodemcu\firmware.elf] Error 1
==================================================================================== [FAILED] Took 3.75 seconds ====================================================================================
the code can by found here: https://github.com/FelixWurm/UniversalLEDInterface
Thanks in advance!