Skip to content

Update SparkFun_I2C_GPS_Arduino_Library.cpp#7

Merged
bboyho merged 1 commit into
masterfrom
v1.0.4
Jun 4, 2020
Merged

Update SparkFun_I2C_GPS_Arduino_Library.cpp#7
bboyho merged 1 commit into
masterfrom
v1.0.4

Conversation

@bboyho
Copy link
Copy Markdown
Contributor

@bboyho bboyho commented Jun 4, 2020

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.

The function `to_string()` seems exclusive to `MBED`. Adding a preprocessor define to wrap it with the `String()` function when using it with `Arduino`.
@bboyho bboyho self-assigned this Jun 4, 2020
@bboyho bboyho merged commit beea5f5 into master Jun 4, 2020
@bboyho bboyho deleted the v1.0.4 branch June 4, 2020 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant