NodeppOficial / nodepp-arduino

Nodepp for Embedded Devices | Arduino
https://www.arduino.cc/reference/en/libraries/nodepp/
MIT License
8 stars 3 forks source link

Including nodepp.h in mulpliple source files #2

Closed barbiani closed 1 month ago

barbiani commented 1 month ago

Hi,

I am experimenting with the library and found that I can not include the header in multiple cpp files due to "multiple definition of `nodepp::..." compilation errors.

Is it supposed to be used like this?

Thanks.

EDBCREPO commented 1 month ago

could you show me the logs?

barbiani commented 1 month ago

Sure.

Create a working cpp project and add a second file.cpp with:

include

include <nodepp/nodepp.h>

Compiling .pio\build\esp32-s3-devkitm-1\src\a.cpp.o Linking .pio\build\esp32-s3-devkitm-1\firmware.elf c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_int(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:656: multiple definition of nodepp::string::to_int(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:656: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_bool(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:665: multiple definition of nodepp::string::to_bool(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:665: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_ldouble(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:674: multiple definition of nodepp::string::to_ldouble(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:674: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_double(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:683: multiple definition of nodepp::string::to_double(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:683: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_float(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:692: multiple definition of nodepp::string::to_float(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:692: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_char(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:701: multiple definition of nodepp::string::to_char(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:701: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_uint(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:710: multiple definition of nodepp::string::to_uint(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:710: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_addr(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:719: multiple definition of nodepp::string::to_addr(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:719: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_wchar(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:728: multiple definition of nodepp::string::to_wchar(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:728: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_long(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:737: multiple definition of nodepp::string::to_long(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:737: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_llong(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:746: multiple definition of nodepp::string::to_llong(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:746: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_ulong(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:755: multiple definition of nodepp::string::to_ulong(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:755: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_ullong(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:764: multiple definition of nodepp::string::to_ullong(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:764: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::console::enable(long)': C:\projects---/lib/nodepp-arduino/src/nodepp/console.h:36: multiple definition of nodepp::console::enable(long)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/console.h:36: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::process::seconds()': C:\projects---/lib/nodepp-arduino/src/nodepp/sleep.h:20: multiple definition of nodepp::process::seconds()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/sleep.h:20: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::process::micros()': C:\projects---/lib/nodepp-arduino/src/nodepp/sleep.h:22: multiple definition of nodepp::process::micros()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/sleep.h:22: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::process::millis()': C:\projects---/lib/nodepp-arduino/src/nodepp/sleep.h:24: multiple definition of nodepp::process::millis()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/sleep.h:24: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::process::delay(unsigned long)': C:\projects---/lib/nodepp-arduino/src/nodepp/sleep.h:34: multiple definition of nodepp::process::delay(unsigned long)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/sleep.h:34: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::process::now()': main.cpp:(.text._ZN6nodepp7process3nowEv+0x0): multiple definition of nodepp::process::now()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:a.cpp:(.text._ZN6nodepp7process3nowEv+0x0): first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::process::yield()': C:\projects---/lib/nodepp-arduino/src/nodepp/sleep.h:38: multiple definition of nodepp::process::yield()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/sleep.h:38: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o:(.bss._ZN6nodepp7process5queueE+0x0): multiple definition ofnodepp::process::queue'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:(.bss._ZN6nodepp7process5queueE+0x0): first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function nodepp::process::size()': C:\projects\---/lib/nodepp-arduino/src/nodepp/task.h:24: multiple definition ofnodepp::process::size()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/task.h:24: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function nodepp::process::clear(void*)': C:\projects\---/lib/nodepp-arduino/src/nodepp/task.h:28: multiple definition ofnodepp::process::clear(void)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/task.h:28: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function nodepp::process::empty()': C:\projects\---/lib/nodepp-arduino/src/nodepp/task.h:26: multiple definition ofnodepp::process::empty()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/task.h:26: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function `nodepp::string::buffer(char const, unsigned long)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:45: multiple definition of nodepp::string::buffer(char const*, unsigned long)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:45: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_string(char)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:795: multiple definition of nodepp::string::to_string(char)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:795: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_string(unsigned int)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:801: multiple definition of nodepp::string::to_string(unsigned int)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:801: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_string(int)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:807: multiple definition of nodepp::string::to_string(int)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:807: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_string(long)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:813: multiple definition of nodepp::string::to_string(long)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:813: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_string(wchar_t)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:819: multiple definition of nodepp::string::to_string(wchar_t)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:819: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_string(unsigned long)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:825: multiple definition of nodepp::string::to_string(unsigned long)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:825: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_string(long long)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:831: multiple definition of nodepp::string::to_string(long long)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:831: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_string(unsigned long long)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:837: multiple definition of nodepp::string::to_string(unsigned long long)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:837: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_string(double)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:843: multiple definition of nodepp::string::to_string(double)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:843: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_string(long double)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:849: multiple definition of nodepp::string::to_string(long double)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:849: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::to_string(float)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:869: multiple definition of nodepp::string::to_string(float)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:869: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::buffer(unsigned long)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:37: multiple definition of nodepp::string::buffer(unsigned long)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:37: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::operator+(nodepp::string_t const&, nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:638: multiple definition of nodepp::operator+(nodepp::string_t const&, nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:638: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::buffer(unsigned long, char const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/string.h:57: multiple definition of nodepp::string::buffer(unsigned long, char const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/string.h:57: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::process::clear()': C:\projects---/lib/nodepp-arduino/src/nodepp/task.h:22: multiple definition of nodepp::process::clear()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/task.h:22: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::process::next()': C:\projects---/lib/nodepp-arduino/src/nodepp/task.h:50: multiple definition of nodepp::process::next()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/task.h:50: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::process::stop()': C:\projects---/lib/nodepp-arduino/src/nodepp/nodepp.h:29: multiple definition of nodepp::process::stop()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/nodepp.h:29: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::split(nodepp::string_t, char)': C:\projects---/lib/nodepp-arduino/src/nodepp/array.h:558: multiple definition of nodepp::string::split(nodepp::string_t, char)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/array.h:558: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::string::split(nodepp::string_t, int)': C:\projects---/lib/nodepp-arduino/src/nodepp/array.h:578: multiple definition of nodepp::string::split(nodepp::string_t, int)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/array.h:578: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::console::wait()': C:\projects---/lib/nodepp-arduino/src/nodepp/console.h:38: multiple definition of nodepp::console::wait()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/console.h:38: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::conio::perr(nodepp::string_t const&)': C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:33: multiple definition of nodepp::conio::perr(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/conio.h:33: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::conio::foreground(int)': C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:116: multiple definition of nodepp::conio::foreground(int)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/conio.h:116: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::conio::error(char const)': C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:152: multiple definition of `nodepp::conio::error(char const)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:152: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function nodepp::conio::info(char const*)': C:\projects\---/lib/nodepp-arduino/src/nodepp/conio.h:156: multiple definition ofnodepp::conio::info(char const)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:156: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function `nodepp::conio::done(char const)': C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:160: multiple definition of nodepp::conio::done(char const*)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects\---/lib/nodepp-arduino/src/nodepp/conio.h:160: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in functionnodepp::conio::warn(char const)': C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:164: multiple definition of `nodepp::conio::warn(char const)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:164: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function nodepp::conio::background(int)': C:\projects\---/lib/nodepp-arduino/src/nodepp/conio.h:82: multiple definition ofnodepp::conio::background(int)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:82: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function nodepp::conio::clear()': C:\projects\---/lib/nodepp-arduino/src/nodepp/conio.h:78: multiple definition ofnodepp::conio::clear()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:78: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function nodepp::console::clear()': C:\projects\---/lib/nodepp-arduino/src/nodepp/console.h:43: multiple definition ofnodepp::console::clear()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/console.h:43: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function nodepp::conio::reset()': C:\projects\---/lib/nodepp-arduino/src/nodepp/conio.h:77: multiple definition ofnodepp::conio::reset()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:77: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function nodepp::conio::inverse()': C:\projects\---/lib/nodepp-arduino/src/nodepp/conio.h:76: multiple definition ofnodepp::conio::inverse()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:76: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function nodepp::conio::undescore()': C:\projects\---/lib/nodepp-arduino/src/nodepp/conio.h:75: multiple definition ofnodepp::conio::undescore()'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:75: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function nodepp::conio::set_position(int, int)': C:\projects\---/lib/nodepp-arduino/src/nodepp/conio.h:70: multiple definition ofnodepp::conio::set_position(int, int)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:70: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function nodepp::conio::gotoxy(int, int)': C:\projects\---/lib/nodepp-arduino/src/nodepp/conio.h:74: multiple definition ofnodepp::conio::gotoxy(int, int)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:C:\projects---/lib/nodepp-arduino/src/nodepp/conio.h:74: first defined here c:/---/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\esp32-s3-devkitm-1\src\main.cpp.o: in function nodepp::conio::pout(nodepp::string_t const&)': main.cpp:(.text._ZN6nodepp5conio4poutERKNS_8string_tE+0x0): multiple definition ofnodepp::conio::pout(nodepp::string_t const&)'; .pio\build\esp32-s3-devkitm-1\src\a.cpp.o:a.cpp:(.text._ZN6nodepp5conio4poutERKNS_8string_tE+0x0): first defined here collect2.exe: error: ld returned 1 exit status *** [.pio\build\esp32-s3-devkitm-1\firmware.elf] Error 1`

EDBCREPO commented 1 month ago

While investigating the issue, I've determined that it's likely a bug in the compiler. I've conducted tests with other libraries (TVout and LiquidCrystal) and the error persists under the same conditions.

I've found a workaround: moving your .cpp files to a subfolder (for example, 'Controllers') prevents the error from occurring. However, I consider this more of a temporary solution rather than a definitive fix.

- Root
| - main.ino
| - Controller
  | - file.cpp

And your code will looks like:

main.ino

#include "Controller/file.cpp"
#include <nodepp/nodepp.h>

// Rest of the code

Controller/file.cpp

#include <Arduino.h>
#include <nodepp/nodepp.h>

// Rest of the code