Hello everyone,
When I attempt to run a simple program using the Ubidots library on the Particle Dev, I continually get the error shown below. However, when I use the Web IDE, I do not get any errors.
Has anyone else had similar issues with libraries on the Particle Dev?
The following is the code I’ve been attempting to compile:
// This example is to save multiple variables to the Ubidots API
#include "Ubidots.h"
#define TOKEN "yyy"
#define Data_Source_Name "zzz"
Ubidots ubidots(TOKEN);
float value1 = 1;
void setup(){
Serial.begin(9600);
ubidots.setDatasourceName(Data_Source_Name);
}
void loop(){
ubidots.add("Variable_Name_One", value1);
ubidots.sendAll();
delay(5000);
value1++;
}
Currently when I attempt to use the Ubidots library with Particle Dev I get the following output from Terminal:
Jeremys-MacBook-Pro:~ Jeremy$ particle compile electron /Users/Jeremy/xxx/Ubidots_practice/
Compiling code for electron
Including:
/Users/Jeremy/xxx/Ubidots_practice/Ubidots.h
/Users/Jeremy/xxx/Ubidots_practice/Ubidots_practice.ino
/Users/Jeremy/xxx/Ubidots_practice/Ubidots.cpp
attempting to compile firmware
Compile failed. Exiting.
In file included from Ubidots.cpp:27:0:
Ubidots.h:34:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
#define SERVER "translate.ubidots.com"
^
Ubidots.h:56:50: note: in expansion of macro 'SERVER'
explicit Ubidots(char* token, char* server = SERVER);
^
Ubidots.cpp: In constructor 'Ubidots::Ubidots(char*, char*)':
Ubidots.cpp:37:13: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
_dsName = "Particle";
^
Ubidots.cpp:38:15: warning: converting to non-pointer type 'float' from NULL [-Wconversion-null]
lastValue = NULL;
^
Ubidots.cpp: In member function 'float Ubidots::getValue(char*)':
Ubidots.cpp:109:19: warning: unused variable 'firstRead' [-Wunused-variable]
unsigned long firstRead = millis();
^
Ubidots.cpp: In member function 'float Ubidots::getValueWithDatasource(char*, char*)':
Ubidots.cpp:203:74: error: invalid conversion from 'const char*' to 'size_t {aka unsigned int}' [-fpermissive]
snprintf(allData, "Particle/1.1|LV|%s|%s:%s|end", _token, dsTag, idName);
^
In file included from /usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/string.h:10:0,
from ../hal/src/electron/modem/enums_hal.h:22,
from ../hal/src/stm32f2xx/platform_headers.h:21,
from ./inc/application.h:32,
from Ubidots.h:29,
from Ubidots.cpp:27:
/usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/stdio.h:261:5: error: initializing argument 2 of 'int snprintf(char*, size_t, const char*, ...)' [-fpermissive]
int _EXFUN(snprintf, (char *__restrict, size_t, const char *__restrict, ...)
^
Ubidots.cpp:219:19: warning: unused variable 'firstRead' [-Wunused-variable]
unsigned long firstRead = millis();
^
Ubidots.cpp: In member function 'bool Ubidots::sendAll()':
Ubidots.cpp:323:20: warning: comparison with string literal results in unspecified behaviour [-Waddress]
if (_dsName == "Particle") {
^
Ubidots.cpp:324:70: error: invalid conversion from 'const char*' to 'size_t {aka unsigned int}' [-fpermissive]
snprintf(allData, "%s|POST|%s|%s=>", USER_AGENT, _token, _pId);
^
In file included from /usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/string.h:10:0,
from ../hal/src/electron/modem/enums_hal.h:22,
from ../hal/src/stm32f2xx/platform_headers.h:21,
from ./inc/application.h:32,
from Ubidots.h:29,
from Ubidots.cpp:27:
/usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/stdio.h:261:5: error: initializing argument 2 of 'int snprintf(char*, size_t, const char*, ...)' [-fpermissive]
int _EXFUN(snprintf, (char *__restrict, size_t, const char *__restrict, ...)
^
Ubidots.cpp:324:70: warning: too many arguments for format [-Wformat-extra-args]
snprintf(allData, "%s|POST|%s|%s=>", USER_AGENT, _token, _pId);
^
Ubidots.cpp:324:70: warning: too many arguments for format [-Wformat-extra-args]
Ubidots.cpp:326:82: error: invalid conversion from 'const char*' to 'size_t {aka unsigned int}' [-fpermissive]
snprintf(allData, "%s|POST|%s|%s:%s=>", USER_AGENT, _token, _pId, _dsName);
^
In file included from /usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/string.h:10:0,
from ../hal/src/electron/modem/enums_hal.h:22,
from ../hal/src/stm32f2xx/platform_headers.h:21,
from ./inc/application.h:32,
from Ubidots.h:29,
from Ubidots.cpp:27:
/usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/stdio.h:261:5: error: initializing argument 2 of 'int snprintf(char*, size_t, const char*, ...)' [-fpermissive]
int _EXFUN(snprintf, (char *__restrict, size_t, const char *__restrict, ...)
^
Ubidots.cpp:326:82: warning: too many arguments for format [-Wformat-extra-args]
snprintf(allData, "%s|POST|%s|%s:%s=>", USER_AGENT, _token, _pId, _dsName);
^
Ubidots.cpp:326:82: warning: too many arguments for format [-Wformat-extra-args]
Ubidots.cpp:329:84: error: invalid conversion from 'const char*' to 'size_t {aka unsigned int}' [-fpermissive]
snprintf(allData, "%s%s:%f", allData, (val + i)->idName, (val + i)->idValue);
^
In file included from /usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/string.h:10:0,
from ../hal/src/electron/modem/enums_hal.h:22,
from ../hal/src/stm32f2xx/platform_headers.h:21,
from ./inc/application.h:32,
from Ubidots.h:29,
from Ubidots.cpp:27:
/usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/stdio.h:261:5: error: initializing argument 2 of 'int snprintf(char*, size_t, const char*, ...)' [-fpermissive]
int _EXFUN(snprintf, (char *__restrict, size_t, const char *__restrict, ...)
^
Ubidots.cpp:331:70: error: invalid conversion from 'const char*' to 'size_t {aka unsigned int}' [-fpermissive]
snprintf(allData, "%s$%s", allData, (val + i)->contextOne);
^
In file included from /usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/string.h:10:0,
from ../hal/src/electron/modem/enums_hal.h:22,
from ../hal/src/stm32f2xx/platform_headers.h:21,
from ./inc/application.h:32,
from Ubidots.h:29,
from Ubidots.cpp:27:
/usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/stdio.h:261:5: error: initializing argument 2 of 'int snprintf(char*, size_t, const char*, ...)' [-fpermissive]
int _EXFUN(snprintf, (char *__restrict, size_t, const char *__restrict, ...)
^
Ubidots.cpp:335:45: error: invalid conversion from 'const char*' to 'size_t {aka unsigned int}' [-fpermissive]
snprintf(allData, "%s,", allData);
^
In file included from /usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/string.h:10:0,
from ../hal/src/electron/modem/enums_hal.h:22,
from ../hal/src/stm32f2xx/platform_headers.h:21,
from ./inc/application.h:32,
from Ubidots.h:29,
from Ubidots.cpp:27:
/usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/stdio.h:261:5: error: initializing argument 2 of 'int snprintf(char*, size_t, const char*, ...)' [-fpermissive]
int _EXFUN(snprintf, (char *__restrict, size_t, const char *__restrict, ...)
^
Ubidots.cpp:338:40: error: invalid conversion from 'const char*' to 'size_t {aka unsigned int}' [-fpermissive]
snprintf(allData, "%s|end", allData);
^
In file included from /usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/string.h:10:0,
from ../hal/src/electron/modem/enums_hal.h:22,
from ../hal/src/stm32f2xx/platform_headers.h:21,
from ./inc/application.h:32,
from Ubidots.h:29,
from Ubidots.cpp:27:
/usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/stdio.h:261:5: error: initializing argument 2 of 'int snprintf(char*, size_t, const char*, ...)' [-fpermissive]
int _EXFUN(snprintf, (char *__restrict, size_t, const char *__restrict, ...)
^
Ubidots.cpp: In member function 'bool Ubidots::sendAllUDP(char*)':
Ubidots.cpp:360:9: warning: unused variable 'size' [-Wunused-variable]
int size;
^
Ubidots.cpp: In member function 'bool Ubidots::sendAll()':
Ubidots.cpp:351:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make[1]: *** [../build/target/user/platform-10Ubidots.o] Error 1
make: *** [user] Error 2
Other info:
I’m using a Particle Electron 0.5.1
MacBook Pro 10.10.5
I feel like I’ve missed something pretty obvious here, so any help would be greatly appreciated.
Thanks in advance!