error: expected primary-expression before '.' token

Hi guys,

I have 12 error: expected primary-expression before '.' token. in my code. Please can you help me fix these.

This is the error code appearing:
/tmp/045508017/sketch_sep1b/sketch_sep1b.ino: In function 'void setup()':

/tmp/045508017/sketch_sep1b/sketch_sep1b.ino:69:8: error: expected primary-expression before '.' token

GPS.begin(9600);

^

/tmp/045508017/sketch_sep1b/sketch_sep1b.ino:70:4: error: expected primary-expression before '.' token

GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);

^

/tmp/045508017/sketch_sep1b/sketch_sep1b.ino:80:10: error: expected primary-expression before '.' token

GPSSerial.println(PMTK_Q_RELEASE);

^

/tmp/045508017/sketch_sep1b/sketch_sep1b.ino:81:20: error: expected primary-expression before '.' token

int realhours = GPS.hour - 8;

^

/tmp/045508017/sketch_sep1b/sketch_sep1b.ino:148:25: error: expected primary-expression before '.' token

dataFile.println(GPS.minute);

^

/tmp/045508017/sketch_sep1b/sketch_sep1b.ino: In function 'void loop()':

/tmp/045508017/sketch_sep1b/sketch_sep1b.ino:162:15: error: expected primary-expression before '.' token

char c = GPS.read();

^

/tmp/045508017/sketch_sep1b/sketch_sep1b.ino:165:10: error: expected primary-expression before '.' token

if (GPS.newNMEAreceived()) {

^

/tmp/045508017/sketch_sep1b/sketch_sep1b.ino:166:23: error: expected primary-expression before '.' token

Serial.println(GPS.lastNMEA());

^

/tmp/045508017/sketch_sep1b/sketch_sep1b.ino:167:13: error: expected primary-expression before '.' token

if (!GPS.parse(GPS.lastNMEA())); //Serial GPS info for debugging

^

/tmp/045508017/sketch_sep1b/sketch_sep1b.ino:167:23: error: expected primary-expression before '.' token

if (!GPS.parse(GPS.lastNMEA())); //Serial GPS info for debugging

^

/tmp/045508017/sketch_sep1b/sketch_sep1b.ino:173:44: error: expected primary-expression before '.' token

if (timer1.finished()) {knot = knot+GPS.speed; knotcounter++;

^

/tmp/045508017/sketch_sep1b/sketch_sep1b.ino:178:13: error: expected primary-expression before '.' token

if (GPS.fix) {

^

exit status 1

Thanks Tom

Speed_coach_code__with_errors.ino (9.56 KB)

#define GPS 
Adafruit_GPS GPS;

Oops

What's wrong with that?

tomsharpe123:
What's wrong with that?

Here's what the compiler sees, after the preprocessor has done its stuffAdafruit_GPS;

What do I need to change it to and should it fix the other errors?

I don't know what you think the "#define GPS" is doing, so I'd simply delete it, and so how it goes.
I didn't read any further than that, so I don't know if anything is lurking further into your code.

That then comes up with GPS is not defined in this scope errors

I can't see your code, I can't see your error messages.

I have attached the code these are the errors that are appearing.

C:\Users\User\OneDrive\Documents\Arduino\Speed_coach_code__with_errors\Speed_coach_code__with_errors.ino:11:0: warning: "GPSSerial" redefined

#define GPSSerial Serial1

^

C:\Users\User\OneDrive\Documents\Arduino\Speed_coach_code__with_errors\Speed_coach_code__with_errors.ino:10:0: note: this is the location of the previous definition

#define GPSSerial

^

C:\Users\User\OneDrive\Documents\Arduino\Speed_coach_code__with_errors\Speed_coach_code__with_errors.ino: In function 'void setup()':

Speed_coach_code__with_errors:68:5: error: 'GPS' was not declared in this scope

GPS.begin(9600);

^

Speed_coach_code__with_errors:79:10: error: expected primary-expression before '.' token

GPSSerial.println(PMTK_Q_RELEASE);

^

C:\Users\User\OneDrive\Documents\Arduino\Speed_coach_code__with_errors\Speed_coach_code__with_errors.ino: In function 'void loop()':

Speed_coach_code__with_errors:161:12: error: 'GPS' was not declared in this scope

char c = GPS.read();

^

exit status 1
'GPS' was not declared in this scope

Speed_coach_code__with_errors.ino (9.5 KB)

#define GPSSerial
...
GPSSerial.println(PMTK_Q_RELEASE);

Same problem as earlier

What happened to the

Adafruit_GPS GPS;

?

What's all this junk?

oled.println("GPSSP V. 2.0.0");
  oled.print("Initializing");
  oled.println(); 
  oled.println(); 
  oled.print("RTI Development");
  delay(500);
  oled.clear();
  oled.println("GPSSP V. 2.0.0");
  oled.print("Initializing.");
  oled.println(); 
  oled.println(); 
  oled.print("RTI Development");
  delay(500);
  oled.clear();
  oled.println("GPSSP V. 2.0.0");
  oled.print("Initializing..");
  oled.println(); 
  oled.println(); 
  oled.print("RTI Development");
  delay(500);
  oled.clear();
  oled.println("GPSSP V. 2.0.0");
  oled.print("Initializing...");
  oled.println(); 
  oled.println(); 
  oled.print("RTI Development");
  delay(500);
  oled.clear();
  oled.println("GPSSP V. 2.0.0");
  oled.print("Initializing..");
  oled.println(); 
  oled.println(); 
  oled.print("RTI Development");
  delay(500);
  oled.clear();
  oled.println("GPSSP V. 2.0.0");
  oled.print("Initializing.");
  oled.println(); 
  oled.println(); 
  oled.print("RTI Development");
  delay(500);
  oled.clear();
  oled.println("GPSSP V. 2.0.0");
  oled.print("Initializing");
  oled.println(); 
  oled.println(); 
  oled.print("RTI Development");

Please use the IDE's auto-format tool before posting your code.

I must have accidentally deleted it, let me add that bit back in. The 'junk' is for when the screen is booting up and getting ready to print the important information.

How can I fix the issue of what the compiler sees.

The junk is the same code, repeated seven times.
Why?

How can I fix the issue of what the compiler sees.

You can either fix it, or you can enlist the help of someone else.