Compiler Error regarding TinyXML2

Hello!
I am new in Arduino and successfully managed to download additional libraries like legolino in Arduino 1.8.16 on a Mac.
My aim is to control my Lego trains with an AZ Delivery ESP32 board and "Mattzobricks" Firmware "MTC4PU".
The ESP32 board works. I could already upload and run the WIFI/WifiScanner example without any issues.

If I compile the "MTC4PU" sketch I got this error message referring to TinyXML2.
I downloaded the ZIP from Github and installed it with Arduino IDE "add *.ZIP Library".
But the Library Manager does NOT show TinyXML2.

The lib files are stored in
...Libraries/tinyxml2/ AND
...Libraries/tinyxml2-master/. AND
...Libraries/MTC4PU/

The compiler show this error message referring to TinyXML2:
It starts after "Linking everything together..." message.

/var/folders/2m/p6ykxhc97ql28jng277hr4d80000gn/T/arduino_build_223830/sketch/tinyxml2.cpp.o:tinyxml2.cpp:(.text._ZN8tinyxml210XMLElement7SetTextEd+0x0): first defined here

/var/folders/2m/p6ykxhc97ql28jng277hr4d80000gn/T/arduino_build_223830/libraries/MTC4PU/tinyxml2.cpp.o: In function `tinyxml2::XMLElement::InsertNewText(char const*)':

tinyxml2.cpp:(.text._ZN8tinyxml210XMLElement13InsertNewTextEPKc+0x0): multiple definition of `tinyxml2::XMLElement::InsertNewText(char const*)'

/var/folders/2m/p6ykxhc97ql28jng277hr4d80000gn/T/arduino_build_223830/sketch/tinyxml2.cpp.o:tinyxml2.cpp:(.text._ZN8tinyxml210XMLElement13InsertNewTextEPKc+0x0): first defined here

collect2: error: ld returned 1 exit status

exit status 1

Fehler beim Kompilieren für das Board ESP32 Dev Module.

What is wrong here?

It looks like you have two copies of the library: one in the sketch folder and another installed normally. That will cause a multiple definitions error.

You should be able to fix it by simply deleting the library files from the sketch folder.

If you will post a link to where you downloaded this sketch from, we might be able to provide you with more effective assistance.

That's normal and expected. Library Manager is only used for managing the Library Manager libraries. You will not see the libraries that you installed via the "Add ZIP Library" menu in Library Manager.

1 Like

Thanks a lot for your quick help!
I deleted the tinyxml2.h and tinyxml2.cpp file from the MTCPU folder and the code was compiling successfully!! :grinning:

I really need to understand how to read this error messages...

BTW:
I downloaded the "MTCPU" firmware from http://mattzobricks.com.
This is all about Lego train automation.

Best regards!

You're welcome. I'm glad to hear it's working now.

This particular flavor of error message is very cryptic unfortunately.

That is the primary error message stating that the linker tries to InsertNewText(char const)* link two compiled functions with the same name.

The two lines befor that states which files contain the compiled function.

'Compiling' consist of a few steps; the last one is the linking of the compiled files and ld refers to / is the linker.

FYI, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the IDE 1.x category.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.