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

Compile Errors. Naming and class I2CGPS has no member named 'begin' Errors #9

Closed edmod209 closed 4 years ago

edmod209 commented 4 years ago

Compile Error 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. Also, should the name be 'SparkFun_I2C_GPS_Arduino_Library'? Quite frankly, I prefer that the Github name be 'SparkFunI2CGPSReadingandControl' and the name field as well as the .ccp and .h names would reflect accordingly. There is no need to called it an Arduino Library in its name.

  2. The 2nd error is that I get 'class I2CGPS' has no member named 'begin'. When I look at other SparkFun coding, there may be a bug. I looked at this link https://github.com/sparkfun/SparkFun_HM1X_Bluetooth_Arduino_Library/issues/1

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

The interesting part is that I don't get errors if I use the Arduino IDE and the supplied libraries in the SparkFun GPS Breakout - XA1110 (Qwiic) Hookup Guide so the issues must be related to the Particle platform

edmod209 commented 4 years ago

This has not been resolved. Here is a message from Particle Support.

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.

  1. 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.

Also around the top of the .h file should have something similar to this:

if defined(PARTICLE)

include "Arduino.h"

elif defined(ARDUINO) && ARDUINO >= 100

include "Arduino.h"

include

elif defined(ARDUINO) && ARDUINO < 100

include "WProgram.h"

include

elif defined(MBED)

include "mbed.h"

include "externs.h"

include

include

include "TinyGPSPlus/TinyGPS++.h"

endif