sparkfun / SparkFun_I2C_GPS_Arduino_Library

Library for reading and controlling MT3333 and MT3339 based GPS modules over I2C.
Other
18 stars 13 forks source link

Update SparkFun_I2C_GPS_Arduino_Library.cpp #7

Closed bboyho closed 4 years ago

bboyho commented 4 years ago

The function to_string() seems exclusive to MBED. Users will get this error.

Arduino: 1.8.12 (Windows 10), Board: "Arduino Uno"

C:\Users\user_bob\Documents\Arduino\libraries\SparkFun_I2C_GPS_Reading_and_Control\src\SparkFun_I2C_GPS_Arduino_Library.cpp: In member function 'String I2CGPS::createMTKpacket(uint16_t, String)':

C:\Users\user_bob\Documents\Arduino\libraries\SparkFun_I2C_GPS_Reading_and_Control\src\SparkFun_I2C_GPS_Arduino_Library.cpp:254:21: error: 'to_string' was not declared in this scope

   configSentence += to_string(packetType);

                     ^~~~~~~~~

C:\Users\user_bob\Documents\Arduino\libraries\SparkFun_I2C_GPS_Reading_and_Control\src\SparkFun_I2C_GPS_Arduino_Library.cpp:254:21: note: suggested alternative: 'String'

   configSentence += to_string(packetType);

                     ^~~~~~~~~

                     String

C:\Users\user_bob\Documents\Arduino\libraries\SparkFun_I2C_GPS_Reading_and_Control\src\SparkFun_I2C_GPS_Arduino_Library.cpp: In member function 'String I2CGPS::createPGCMDpacket(uint16_t, String)':

C:\Users\user_bob\Documents\Arduino\libraries\SparkFun_I2C_GPS_Reading_and_Control\src\SparkFun_I2C_GPS_Arduino_Library.cpp:338:21: error: 'to_string' was not declared in this scope

   configSentence += to_string(packetType);

                     ^~~~~~~~~

C:\Users\user_bob\Documents\Arduino\libraries\SparkFun_I2C_GPS_Reading_and_Control\src\SparkFun_I2C_GPS_Arduino_Library.cpp:338:21: note: suggested alternative: 'String'

   configSentence += to_string(packetType);

                     ^~~~~~~~~

                     String

Adding a preprocessor define to wrap it with the String() function when using it with Arduino so that it can compile.