NeoGPS -- anyone get Examples to compile?

I am using TinyGPS++ and just found out about NeoGPS, but none of the Examples will compile. I found some other mentions of the same problem but no solution yet.

This is what I get and it is beyond my C++ skills to fix it myself.


Arduino: 1.6.5 (Windows 7), Board: "Arduino/Genuino Uno"

In file included from D:\ArduinoLib\libraries\NeoGPS-master/NMEAGPS.h:25:0,
from NMEA.ino:8:
D:\ArduinoLib\libraries\NeoGPS-master/NMEAGPS_cfg.h:156:2: error: #error You must define NMEAGPS_DERIVED_TYPES in NMEAGPS.h in order to parse Talker and/or Mfr IDs!
#error You must define NMEAGPS_DERIVED_TYPES in NMEAGPS.h in order to parse Talker and/or Mfr IDs!
^
NMEA.ino: In function 'void setup()':
NMEA:33: error: 'Serial1' was not declared in this scope
NMEA.ino: In function 'void loop()':
NMEA:43: error: 'Serial1' was not declared in this scope
'Serial1' was not declared in this scope

There are two problems.

  1. You have not defined NMEAGPS_DERIVED_TYPES, as required.
  2. You do not have, or have not defined a serial port named Serial1. Probably, you are using the wrong Arduino.

You may want to look through the installation instructions.

The first example, "NMEA", doesn't compile for me either.
I have a stock Uno R3. I tried with both IDE 1.0.6 and 1.6.4.

If it doesn't compile for an Uno out of the box, what Arduino is it meant for?

Serial1 suggests a Mega.

I think NeoGPS is a good library. But documentation isn't the author's strong point.

It should work with an Uno out of the box.

jboyton:
It should work with an Uno out of the box.

Using the zip library installer, I tried on two different computers. Exact same issues. Same for a Nano on both, too.

I have a mega arriving tomorrow, so will see if that makes a difference, but I suspect not, as the errors seem to be fundamental omissions. That does not give confidence for the rest of the library. I guess I will stay with TinyGPS++.

but I suspect not, as the errors seem to be fundamental omissions

The omission is yours. It won't work until you define NMEAGPS_DERIVED_TYPES appropriately.

It's funny, when this was first announced I downloaded it and tested it on my Uno. I was impressed with it. But that test sketch doesn't compile with the latest code.

I skimmed through the doc files and couldn't really figure out what I was supposed to do to get it to compile. Where am I supposed to define NMEAGPS_DERIVED_TYPES? Where is this described in the documentation? Why isn't it defined for the basic examples? How do I tell the code I'm using an Uno instead of a Mega?

Please advise.

NMEAGPS_DERIVED_TYPES is mentioned in the Configurations readme but I agree, this package is certainly not ready for general distribution. There are far too many conditional compilation options for beginners, and most experts won't want to take the trouble.

jremington:
The omission is yours. It won't work until you define NMEAGPS_DERIVED_TYPES appropriately.

Ummm, not so. Did you not read my first post fully? To wit...

"...and it is beyond my C++ skills to fix it myself."

I CAN read and I CAN understand error messages. What I do not know how to do is what the error messages are telling me. Sooo, I again join JBoyton in noting, the NONE of Examples compile as installed. That's how all the other libraries I have installed in the Arduino IDE have performed, this should be no different. But, hey, I have been wrong before.

I have been a programmer for 40+ years but have never used C or it's later derivatives. When I write software for others to use, I expect them to plug it in, turn it on and use it. Not an unreasonable expectation, I feel.

However the point is now moot. I have just written my own small section of code to read the GPS Sentence stream and decode just the two sentences I need. Currently at 59 lines of code, it gives me everything I want for my project and NO GPS libraries needed. Daved me 228 Bytes of memory.

Ummm, not so. Did you not read my first post fully? To wit...

"...and it is beyond my C++ skills to fix it myself."

I suspect simple laziness. You didn't read post #1 fully, nor did you read the installation instructions. Installing.md describes what needs to be done and even gives the required definition:

There are also several example configurations in the config subdirectory. Not all configurations will work with all example applications. Specifically, PUBX.ino and ublox.ino both require the following to be enabled in NMEAGPS_cfg.h:

#define NMEAGPS_DERIVED_TYPES

I am using TinyGPS++ and just found out about NeoGPS, but none of the Examples will compile.

LOL, I go offline for a week, and someone finally asks a question about NeoGPS... :smiley:

TL;DR - Comment out PARSE_MFR_ID in NMEAGPS_cfg.h:

    //#define PARSE_MFR_ID

And for a non-Mega boards, like the Uno, get the latest NMEA.ino. Other examples to follow.


TL

the errors seem to be fundamental omissions. That does not give confidence for the rest of the library... NONE of Examples compile as installed. That's how all the other libraries I have installed in the Arduino IDE have performed, this should be no different.

Yes, this was definitely my fault, and your skepticism is completely understandable. It is very possible that I checked in a non-default configuration file after testing a different configuration. There are thousands of possible configurations, and I have only tested a covering set of dozens.

Ah, yes... after a quick look, it appears that PARSE_MFR_ID in NMEAGPS_cfg.h should have been commented out for the default configuration. A thousand apologies! (One for each configuration. :slight_smile: ) I'm sorry you were thwarted by this mistake.

It should work with an Uno out of the box. How do I tell the code I'm using an Uno instead of a Mega?

The only change should be using a SoftwareSerial instance instead of Serial1. I have struggled with what configuration and platform should be "the default". I think I should be able to support both the Mega and Uno platforms in the examples with conditional code, like other libraries. That's a good suggestion.

Where am I supposed to define NMEAGPS_DERIVED_TYPES? Where is this described in the documentation? Why isn't it defined for the basic examples?

Well, I thought this was clear, but I obviously missed. Hmmm... NeoGPS is different because I expect the user to modify these configuration files: NeoGPS_cfg.h, GPSfix_cfg.h, and NMEAGPS_cfg.h. Typically, users treat the libraries as sacred read-only files.

Unfortunately, there is no other C++ technique that allows class/struct members to be eliminated from RAM. Compile and link optimizations can eliminate some, but not all, parsing code from FLASH, a situation similar the sprintf bloat problem. Up to IDE 1.6.x, library management did not support configuration files in the (local) INO directory instead of the library directory, but maybe that has changed.

Perhaps a step-by-step guide would help, especially to show that it's ok to edit the sacred files. Maybe an HTML configuration page? After I get a few things out of the way from being absent, I'll update the examples and docs, and post an update in the NeoGPS thread.

I have just written my own small section of code to read the GPS Sentence stream and decode just the two sentences I need. Currently at 59 lines of code, it gives me everything I want for my project and NO GPS libraries needed. Saved me 228 Bytes of memory.

Would you mind sharing?

Many users have successfully used other libraries for basic GPS processing. NeoGPS is for those users who are stepping past the typical usage and may need to squeeze more performance out of an Arduino, or save a few hundred bytes of RAM.

Many users are also quickly frustrated by other libraries when they get to that point. Although I have focused on supporting advanced users, better docs and examples may allow a wider audience to take advantage of its features and avoid frustration with other libraries.This topic comes up quite frequently. Umm, compiling without errors would also help... :-[

Thanks, everyone, for the comments and suggestions!
/dev