Library TinyGPS++ problem

I have TinyGPSPLUS installed in my Library from the Library Manager. When I select TinyGPSPLUS from my Library I get #include <ADS1100.h> added to my sketch; not the <TinyGPS++.h> I would expect based on numerous examples I have studied.
My compiler will not recognize either one.

Maybe you can help me sort this out.
Thanks.

Why not just edit your sketch to #include the correct library?

Have you tried typing `#include <TinyGPS++.h>' ?

And you did install the TinyGPS++ library, right?

There is no such thing as TinyGPS++ listed in the Library Manager. It is listed as TinyGPSPLUS. If I download this to my library and then try to use it, I get #include <ADS1100.h> added to my sketch.
Of course, that is not recognized by the compiler.
If I type #include <TinyGPS++.h>, it also is not recognized by the compiler.
Please do me a favor and add TinyGPSPLUS to your library and see what happens when you select it in your library list for a new sketch. See if you get #include <ADS1100.h>.
Thanks,

GitHub - mikalhart/TinyGPSPlus: A new, customizable Arduino NMEA parsing library

This example code works for me. Notice the #include is <TinyGPS++.h>?

#include <TinyGPS++.h>
/* 
   This sample sketch should be the first you try out when you are testing a TinyGPS++
   (TinyGPSPlus) installation.  In normal use, you feed TinyGPS++ objects characters from
   a serial NMEA GPS device, but this example uses static strings for simplicity.
*/

// A sample NMEA stream.
const char *gpsStream =
  "$GPRMC,045103.000,A,3014.1984,N,09749.2872,W,0.67,161.46,030913,,,A*7C\r\n"
  "$GPGGA,045104.000,3014.1985,N,09749.2873,W,1,09,1.2,211.6,M,-22.5,M,,0000*62\r\n"
  "$GPRMC,045200.000,A,3014.3820,N,09748.9514,W,36.88,65.02,030913,,,A*77\r\n"
  "$GPGGA,045201.000,3014.3864,N,09748.9411,W,1,10,1.2,200.8,M,-22.5,M,,0000*6C\r\n"
  "$GPRMC,045251.000,A,3014.4275,N,09749.0626,W,0.51,217.94,030913,,,A*7D\r\n"
  "$GPGGA,045252.000,3014.4273,N,09749.0628,W,1,09,1.3,206.9,M,-22.5,M,,0000*6F\r\n";

// The TinyGPS++ object
TinyGPSPlus gps;

void setup()
{
  Serial.begin(115200);

  Serial.println(F("BasicExample.ino"));
  Serial.println(F("Basic demonstration of TinyGPS++ (no device needed)"));
  Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
  Serial.println(F("by Mikal Hart"));
  Serial.println();

  while (*gpsStream)
    if (gps.encode(*gpsStream++))
      displayInfo();

  Serial.println();
  Serial.println(F("Done."));
}

void loop()
{
}

void displayInfo()
{
  Serial.print(F("Location: ")); 
  if (gps.location.isValid())
  {
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(","));
    Serial.print(gps.location.lng(), 6);
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F("  Date/Time: "));
  if (gps.date.isValid())
  {
    Serial.print(gps.date.month());
    Serial.print(F("/"));
    Serial.print(gps.date.day());
    Serial.print(F("/"));
    Serial.print(gps.date.year());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F(" "));
  if (gps.time.isValid())
  {
    if (gps.time.hour() < 10) Serial.print(F("0"));
    Serial.print(gps.time.hour());
    Serial.print(F(":"));
    if (gps.time.minute() < 10) Serial.print(F("0"));
    Serial.print(gps.time.minute());
    Serial.print(F(":"));
    if (gps.time.second() < 10) Serial.print(F("0"));
    Serial.print(gps.time.second());
    Serial.print(F("."));
    if (gps.time.centisecond() < 10) Serial.print(F("0"));
    Serial.print(gps.time.centisecond());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.println();
}

There does appear to be a problem with the "Arduino official" TinyGPSPLUS library, which is maintained by someone other than the original author Mikal Hart. The error message says it is configured for ESP32 and is incompatible with other boards.

Go here to download the correct library: TinyGPS++ | Arduiniana

Unzip it in the sketch /libraries folder and delete the other library.

Or, use the menu sketch > include library > add .zip library

Although I think you have already been given good advice about using the original library, I'll provide some explanation of why you experienced this weird behavior from the library:

The reason for it is this line of the library's metadata file:
https://github.com/Tinyu-Zhao/TinyGPSPlus/blob/v1.0.0a/library.properties#L10

includes=ADS1100.h

When the library author adds an includes field to their metadata, the Arduino IDE simply adds #include directives for those file names to the sketch when you select it from the Sketch > Include Library menu.

Probably it was a copy/paste error because the library never contained a file of that name. I see they have since removed the erroneous metadata:

But unfortunately they have not made a new release since that time so the release version you get from Library Manager still has the error.

But Sketch > Include Library is only a convenience feature. There is no magic to it. You get the identical result by manually adding the #include directive. In this case, you can see the file name is TinyGPSPlus.h:
https://github.com/Tinyu-Zhao/TinyGPSPlus/blob/v1.0.0a/src/TinyGPSPlus.h

Thanks to all for the quick response to my problem. Just using <TinyGPSPlus.h> in place of <TinyGPS++.h> solved the problem.

Buddy, you are taking a lot of stress.

After the update you need to use the file name as "TinyGPSPLus" and not "TinyGPS++"

This will definitely resolve your problem.

I have some great news to update this discussion:

Since the time of my last reply, the maintainer of the fork published to Library Manager worked with the original author Mikal Hart in order to resolve the confusions reported here.

https://github.com/mikalhart/TinyGPSPlus/issues/85#issuecomment-1006167713

So the library listed as "TinyGPSPlus" in Library Manager is now the original library, maintained by the original author.

The fork is now listed under the name "TinyGPSPlus-ESP32" and the fix to the metadata has also been published.

It was really nice to see the Arduino community cooperate to improve the accessibility of this library. Since library names in Library Manager are allocated on a "first come" basis, the maintainer of the fork was under no obligation to give up the name.

I don't think "need" is accurate. It is true that the best practice is for the header file name to match the library name. For this reason, a header file named TinyGPSPLus.h was added to the library during the preparation for publishing it in the Arduino Library Manager:

However, this was not a breaking change because the library still contains the TinyGPS++.h file just like always, with the same content as always. TinyGPSPLus.h, contains only an #include directive for TinyGPS++.h:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.