[SOLVED] Arduino SDK: Compiler error when linked with ubidots library (Arduino Yun)

I have ARDUINO 1.6.12 Software and Arduino YUN device.
I have the latest ubidots library as pointed by https://ubidots.com/docs/devices/ArduinoYUN.html#arduino-yun
I get compilation error when I link the library.

Arduino: 1.6.7 (Windows 10), Board: “Arduino Yún”

In file included from \Documents\Arduino\libraries\ubidots-arduino-yun-master\examples\UbidotsGetValue\UbidotsGetValue.ino:1:0:

\Documents\Arduino\libraries\ubidots-arduino-yun-master/UbidotsYUN.h:30:16: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

#define SERVER “translate.ubidots.com

            ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master/UbidotsYUN.h:44:52: note: in expansion of macro ‘SERVER’

   explicit Ubidots(char* token, char* server = SERVER);

                                                ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master\examples\UbidotsGetValue\UbidotsGetValue.ino:5:21: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

Ubidots client(TOKEN);

                 ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master\examples\UbidotsGetValue\UbidotsGetValue.ino:5:21: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

In file included from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:26:0:

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.h:30:16: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

#define SERVER “translate.ubidots.com

            ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.h:44:52: note: in expansion of macro ‘SERVER’

   explicit Ubidots(char* token, char* server = SERVER);

                                                ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:31:1: error: prototype for ‘Ubidots::Ubidots(char*)’ does not match any in class ‘Ubidots’

Ubidots::Ubidots(char* token) {

^

In file included from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:26:0:

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.h:42:7: error: candidates are: constexpr Ubidots::Ubidots(Ubidots&&)

class Ubidots {

   ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.h:42:7: error: constexpr Ubidots::Ubidots(const Ubidots&)

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.h:44:16: error: Ubidots::Ubidots(char*, char*)

   explicit Ubidots(char* token, char* server = SERVER);

            ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp: In member function ‘void Ubidots::sendAll()’:

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:148:41: error: invalid conversion from ‘const char*’ to ‘size_t {aka unsigned int}’ [-fpermissive]

 snprintf(buffer, "(sleep 1\necho \"");

                                     ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:148:41: error: too few arguments to function ‘int snprintf(char*, size_t, const char*, …)’

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:24:0,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:224,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Bridge.h:26,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Process.h:22,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.h:28,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:26:

c:\program files (x86)\arduino\hardware\tools\avr\avr\include\stdio.h:685:12: note: declared here

extern int snprintf(char *__s, size_t __n, const char *__fmt, …);

        ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:150:92: error: invalid conversion from ‘const char*’ to ‘size_t {aka unsigned int}’ [-fpermissive]

     snprintf(buffer, "%s%s%s|POST|%s|%s=>", buffer, USER_AGENT, VERSION, _token, _dsTag);

                                                                                        ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:24:0,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:224,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Bridge.h:26,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Process.h:22,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.h:28,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:26:

c:\program files (x86)\arduino\hardware\tools\avr\avr\include\stdio.h:685:12: error: initializing argument 2 of ‘int snprintf(char*, size_t, const char*, …)’ [-fpermissive]

extern int snprintf(char *__s, size_t __n, const char *__fmt, …);

        ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:152:104: error: invalid conversion from ‘const char*’ to ‘size_t {aka unsigned int}’ [-fpermissive]

     snprintf(buffer, "%s%s%s|POST|%s|%s:%s=>", buffer, USER_AGENT, VERSION, _token, _dsTag, _dsName);

                                                                                                    ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:24:0,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:224,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Bridge.h:26,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Process.h:22,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.h:28,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:26:

c:\program files (x86)\arduino\hardware\tools\avr\avr\include\stdio.h:685:12: error: initializing argument 2 of ‘int snprintf(char*, size_t, const char*, …)’ [-fpermissive]

extern int snprintf(char *__s, size_t __n, const char *__fmt, …);

        ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:156:77: error: invalid conversion from ‘const char*’ to ‘size_t {aka unsigned int}’ [-fpermissive]

     snprintf(buffer, "%s%s:%s", buffer, (val + i)->idName, value.c_str());

                                                                         ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:24:0,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:224,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Bridge.h:26,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Process.h:22,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.h:28,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:26:

c:\program files (x86)\arduino\hardware\tools\avr\avr\include\stdio.h:685:12: error: initializing argument 2 of ‘int snprintf(char*, size_t, const char*, …)’ [-fpermissive]

extern int snprintf(char *__s, size_t __n, const char *__fmt, …);

        ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:158:67: error: invalid conversion from ‘const char*’ to ‘size_t {aka unsigned int}’ [-fpermissive]

         snprintf(buffer, "%s\\$%s", buffer, (val + i)->context);

                                                               ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:24:0,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:224,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Bridge.h:26,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Process.h:22,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.h:28,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:26:

c:\program files (x86)\arduino\hardware\tools\avr\avr\include\stdio.h:685:12: error: initializing argument 2 of ‘int snprintf(char*, size_t, const char*, …)’ [-fpermissive]

extern int snprintf(char *__s, size_t __n, const char *__fmt, …);

        ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:162:43: error: invalid conversion from ‘const char*’ to ‘size_t {aka unsigned int}’ [-fpermissive]

         snprintf(buffer, "%s,", buffer);

                                       ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:24:0,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:224,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Bridge.h:26,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Process.h:22,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.h:28,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:26:

c:\program files (x86)\arduino\hardware\tools\avr\avr\include\stdio.h:685:12: error: initializing argument 2 of ‘int snprintf(char*, size_t, const char*, …)’ [-fpermissive]

extern int snprintf(char *__s, size_t __n, const char *__fmt, …);

        ^

\Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:165:70: error: invalid conversion from ‘const char*’ to ‘size_t {aka unsigned int}’ [-fpermissive]

 snprintf(buffer, "%s|end\") | telnet %s %s", buffer, SERVER, PORT);

                                                                  ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:24:0,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:224,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Bridge.h:26,

             from C:\Program Files (x86)\Arduino\libraries\Bridge\src/Process.h:22,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.h:28,

             from \Documents\Arduino\libraries\ubidots-arduino-yun-master\UbidotsYUN.cpp:26:

c:\program files (x86)\arduino\hardware\tools\avr\avr\include\stdio.h:685:12: error: initializing argument 2 of ‘int snprintf(char*, size_t, const char*, …)’ [-fpermissive]

extern int snprintf(char *__s, size_t __n, const char *__fmt, …);

        ^

exit status 1
Error compiling.

@jagstock

We fixed a problem in compilation in some pc’s, now it will working fine.
You can download the latest version of the library from github and upload it to YUN.

I apologize for the error it will not happen again.

Best regards,
Metavix

Hi Metavix

Just now downloaded everything and trying to compile example sketch UbidotsSaveValue.ino but there are some warnings. In case the feedback helps, please see below.

#include <Ethernet.h>
#include <SPI.h>
#include <UbidotsEthernet.h>

Fri 30 Sep 2016 12:25:57 AWST
Arduino 1.6.12
Darwin xxxxx 15.6.0 Darwin Kernel Version 15.6.0: Mon Aug 29 20:21:34 PDT 2016; root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64
OS X 10.11.6 Build 15G1004
UbidotsSaveValue.ino

Can I ignore these warnings?

    .../Desktop/UbidotsSaveValue/UbidotsSaveValue.ino:13:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
 Ubidots client(TOKEN);
                     ^
.../Desktop/UbidotsSaveValue/UbidotsSaveValue.ino: In function 'void loop()':
.../Desktop/UbidotsSaveValue/UbidotsSaveValue.ino:28:25: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
     client.add(ID, value);
                         ^
.../Documents/Arduino/libraries/ubidots-arduino-ethernet-master/UbidotsEthernet.cpp: In member function 'float Ubidots::getValue(char*)':
.../Documents/Arduino/libraries/ubidots-arduino-ethernet-master/UbidotsEthernet.cpp:40:16: warning: converting to non-pointer type 'float' from NULL [-Wconversion-null]
         return NULL;
                ^

More info in case it is relevant:

    $ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Thanks for any advice you can offer.

Regards
James

yeah @jamestoher you can ignore these warnings.
The program will compile and upload to the device.

Best regards,
Metavix

Hello Metavix,
Thanks, after downloading the latest version of library from github and it works now !

@jagstock nice you are welcome!

Best regards,
Metavix