Integrate Thinger Arduino lib in another Library

Hello everyone !

I am currently trying to implement thinger.io in my own Arduino Library (hereafter named “VRTracker”).
My final board being an ESP8266.

Here is the deal :

I cannot include ThingerSmartConfig.h or ThingerESP8266.h in VRTracker.h

Here is the error log :

libraries/VRTracker/VRTracker.cpp.o: In function `VRTracker::sendInfrared(String)':
/Users/julesthuillier/Documents/Arduino/libraries/thinger.io/src/thinger/pson.h:479: multiple definition of `thinger::thinger_resource::streaming_count_'
sketch/Tag.ino.cpp.o:(.bss._ZN7thinger16thinger_resource16streaming_count_E+0x0): first defined here
libraries/VRTracker/VRTracker.cpp.o: In function `digital_pin(protoson::pson&, int)':
VRTracker.cpp:(.text._Z11digital_pinRN8protoson4psonEi+0xc): multiple definition of `digital_pin(protoson::pson&, int)'
sketch/Tag.ino.cpp.o:/Users/julesthuillier/Documents/Arduino/libraries/thinger.io/src/ThingerClient.h:307: first defined here
libraries/VRTracker/VRTracker.cpp.o: In function `inverted_digital_pin(protoson::pson&, int)':
VRTracker.cpp:(.text._Z20inverted_digital_pinRN8protoson4psonEi+0xc): multiple definition of `inverted_digital_pin(protoson::pson&, int)'
sketch/Tag.ino.cpp.o:/Users/julesthuillier/Documents/Arduino/libraries/thinger.io/src/ThingerClient.h:316: first defined here
libraries/VRTracker/VRTracker.cpp.o:(.data.alloc+0x0): multiple definition of `alloc'
sketch/Tag.ino.cpp.o:(.data.alloc+0x0): first defined here
libraries/VRTracker/VRTracker.cpp.o: In function `analog_pin(protoson::pson&, int)':
VRTracker.cpp:(.text._Z10analog_pinRN8protoson4psonEi+0x20): multiple definition of `analog_pin(protoson::pson&, int)'
sketch/Tag.ino.cpp.o:/Users/julesthuillier/Documents/Arduino/libraries/thinger.io/src/ThingerClient.h:353: first defined here
libraries/VRTracker/VRTracker.cpp.o:(.rodata._ZN8protoson4poolE+0x0): multiple definition of `protoson::pool'
sketch/Tag.ino.cpp.o:(.rodata._ZN8protoson4poolE+0x0): first defined here
collect2: error: ld returned 1 exit status
exit status 1

First the first line of that log is weird, it tells about VRTracker::sendInfrared, but that function is empty :

void VRTracker::sendInfrared(String data){
  //  ir.send(data);
}

I tried to include the Thinger library in my CPP (VRTracker.cpp), and that actually works. Same if I include ThingerSmartConfig.h directly in the skectch.
But none of those fix helps because I want to keep a reference to thinger object to call it in different functions of my library.

Did any of you managed to include Thinger library in your own Arduino Library ? :slight_smile:

Hi Jules!

What you are working on!? A tracker for virtual reality!? I want to see this project! :slight_smile:

Regarding your question, I have never tried to include the thinger library inside another Arduino Library. But I suppose you should be able to just copy the thinger.io src in your src folder. Seems that you are including the library twice. Check that your sketch is not including the library also, and try to remove the thinger library from your Arduino folder.

Bests.