SparkFun GPS Breakout - XA1110 (Qwiic) Shield Compile Error with Photon

Having issues with making the GPS Shield from Sparkfun work.
I have compile errors when using this code on the Particle platform. When I using Visual Studio Code as the editor, I get 2 of the following errors:

  1. The library.properties file within the ‘name’ field has the name ‘SparkFun I2C GPS Reading and Control’. When I compile, it doesn’t like having spaces in its name. Once I remove the spaces, it compiles.
  2. The 2nd error is that I get ‘class I2CGPS’ has no member named ‘begin’.

I have been using TingGPS.ino sample code supplied with this library.

Interestingly, I get no compile errors using the unmodified version of the library with the Arduino IDE. Its somehow related to the Particle platform. Considering the Photon is Arduino compatible, I am surprised that it has these issues.

  1. This is a common problem with Sparkfun Arduino libraries. The Arduino IDE doesn’t really care about the name in the project.properties, but Particle expects it to match the directory name. But beyond that it really isn’t used for much. I just set it to the repo name when porting, so SparkFun_I2C_GPS_Arduino_Library.

  2. This is because the library only defines begin() if ARDUINO or __MBED__ is defined. Particle only defines ARDUINO if Arduino.h is included, but that’s in an #ifdef, so it never gets included. The easiest workaround is to just modify that #ifdef in the .h file so Arduino.h is always included.

Thanks for that. So just to confirm, I should change the coding in SparkFun_I2C_GPS_Arduino_Library.h file so that all the if-else statements that chooses between Arduino definition and MBED definition to always choose the Arduino definition?

Correct, that should do it, though I didn’t actually test to be sure.

Issue is that SparkFun_I2C_GPS_Arduino_Library.cpp also has the if-else statements. Do I change that too?

Should not be necessary because the first thing the .cpp file does is include the .h file, and if the .h file does a #include "Arduino.h" then ARDUINO will now be defined and everything will be fine. It’s just making sure that Arduino.h gets included or else everything else goes downhill from there.

#if defined(PARTICLE)
#include "Arduino.h"
#elif defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#include <Wire.h>
#elif defined(ARDUINO) && ARDUINO < 100
#include "WProgram.h"
#include <Wire.h>
#elif defined(__MBED__)
#include "mbed.h"
#include "externs.h"
#include <cstdlib>
#include <string>
#include "TinyGPSPlus/TinyGPS++.h"
#endif

Great it worked! Thanks for your help.
On other thing, I have loaded private libraries using the particle CLI command “particle library upload”. I no longer use them so how do I remove them? They seem to have a ‘lock’ on them in the web interface