Compile Error with UbidotsSaveValue Example on YUN when using Bridge


#1

Hi All,

the UbidotsSaveValue Example from the UbidotsYUN library works fine as it is.
As soon as I include the Bridge library I get the following compile errors:

C:\Temp\cc3wJTrW.ltrans0.ltrans.o: In function Ubidots::sendAll() [clone .constprop.12]': cc3wJTrW.ltrans0.o:(.text+0x638): undefined reference tovtable for Process’
cc3wJTrW.ltrans0.o:(.text+0x63a): undefined reference to vtable for Process' cc3wJTrW.ltrans0.o:(.text+0x648): undefined reference toBridge’
cc3wJTrW.ltrans0.o:(.text+0x64a): undefined reference to Bridge' cc3wJTrW.ltrans0.o:(.text+0xa3c): undefined reference toProcess::runShellCommand(String const&)’
cc3wJTrW.ltrans0.o:(.text+0xa64): undefined reference to Process::running()' cc3wJTrW.ltrans0.o:(.text+0xaba): undefined reference toProcess::~Process()’
C:\Temp\cc3wJTrW.ltrans0.ltrans.o: In function main': cc3wJTrW.ltrans0.o:(.text.startup+0x1d4): undefined reference toBridge’
cc3wJTrW.ltrans0.o:(.text.startup+0x1d8): undefined reference to Bridge' cc3wJTrW.ltrans0.o:(.text.startup+0x224): undefined reference toBridge’
cc3wJTrW.ltrans0.o:(.text.startup+0x226): undefined reference to Bridge' cc3wJTrW.ltrans0.o:(.text.startup+0x228): undefined reference toBridgeClass::begin()’
collect2.exe: error: ld returned 1 exit status


Device: Arduino Yun
IDE: 1.6.12 from arduino.cc on Win10

Code:
#include <Bridge.h>
#include <UbidotsYUN.h>
#define TOKEN “MY_TOKEN_HERE”

Ubidots client(TOKEN);

void setup() {
client.init();
Serial.begin(9600);
}

void loop() {
float value = analogRead(A0);
client.add(“Variable_Name”, value);
client.sendAll();
}


Any idea anybody?

Many thanks in advance,
Stefan


#2

Hi @stefan,

We can’t replicate the error. Here’s the code that i tested

#include <UbidotsYUN.h>
#define TOKEN "YOUR_TOKEN_HERE"
#include <Process.h>


Ubidots client(TOKEN);

void setup() {
 client.init();
 Serial.begin(9600);
 Bridge.begin();
}

void loop() {
 float value = analogRead(A0);
 client.add("Variable_Name", value);
 client.sendAll(); 
}

Regards


#3

Hi @mariahernandez,

sorry for wasting your time, my code example was incomplete.
The angle brackets around the library names in the include statements make the rest of the line disappear
in this textbox if not using the “preformatted text” option.

#include <Bridge.h> became #include in my code sample above.

So, the #include <Bridge.h> causes the compile error.

Meanwhile I think I got a solution, it seems to be a matter of the order of including the libraries.
This order results in a compile error.

#include <Bridge.h> #include <UbidotsYUN.h>

Include Bridge after UbidotsYUN library and it compiles without error.
#include <UbidotsYUN.h> #include <Bridge.h>

So this one seems to be solved, just wrote it down in case somebody else runs into the same problem.