Expected unqualified ID before "(" token

I've gone through the code with a magnifying glass, and reduced the number of errors. I tried to figure the last few out and checked the example codes as well, but 2-3 errors are present and I'm unable to figure it out.

Arduino: 1.8.13 (Mac OS X), Board: "Arduino Nano, ATmega328P"











/Users/Taran/Documents/Arduino/flight_logger/flight_logger.ino: In function 'void loop()':
flight_logger:99:17: error: redeclaration of 'long unsigned int age'
   unsigned long age;
                 ^~~
/Users/Taran/Documents/Arduino/flight_logger/flight_logger.ino:66:17: note: 'long unsigned int age' previously declared here
   unsigned long age;
                 ^~~
flight_logger:100:65: error: no matching function for call to 'TinyGPS::crack_datetime(int*, byte*, byte*, byte*, byte*, long unsigned int*)'
   gps.crack_datetime(&year, &month, &day, &minute, &second, &age);
                                                                 ^
In file included from /Users/Taran/Documents/Arduino/flight_logger/flight_logger.ino:4:0:
/Users/Taran/Documents/Arduino/libraries/TinyGPS/src/TinyGPS.h:83:8: note: candidate: void TinyGPS::crack_datetime(int*, byte*, byte*, byte*, byte*, byte*, byte*, long unsigned int*)
   void crack_datetime(int *year, byte *month, byte *day,
        ^~~~~~~~~~~~~~
/Users/Taran/Documents/Arduino/libraries/TinyGPS/src/TinyGPS.h:83:8: note:   no known conversion for argument 6 from 'long unsigned int*' to 'byte* {aka unsigned char*}'
Multiple libraries were found for "Adafruit_SSD1306.h"
 Used: /Users/Taran/Documents/Arduino/libraries/Adafruit_SSD1306
 Not used: /Users/Taran/Documents/Arduino/libraries/Adafruit_SSD1306_Wemos_Mini_OLED
exit status 1
redeclaration of 'long unsigned int age'


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

code:


#include <SPI.h>
#include <Wire.h>
#include <TinyGPS.h>
#include <SoftwareSerial.h>
#include <SD.h>
#include <Adafruit_SSD1306.h>

// --------------------------------------------------------------------------initialising the display------------------------------------------------------------------------------------------------------------------------------------------------------

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define display_RESET -1 // since sharing reset pin with Arduino
#define SCREEN_ADDRESS 0x3C
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, display_RESET);
const int cs_sd = 2;
static const int RX = 3, TX = 4;
static const uint32_t gps_baud = 9600; // might need to change later on depending on sensitivity and speed requirements.
TinyGPS gps;
SoftwareSerial ss(RX, TX);

int speedMax = 0, speedCheck = 0;
int heightMax = 0, heightCheck = 0;
int satMax = 0, satCheck = 0;



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

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
  for (;;); // Don't proceed, loop forever

  }

  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(15, 40);
  display.write("VP-DK Avionics");
  display.write("Flight Logger ver1.0");
  delay(2000);
  display.clearDisplay();
  Wire.begin();
  ss.begin(gps_baud);

  if (!SD.begin(cs_sd)); {
    display.clearDisplay();
    display.write("Default Card.");
    delay(500);
    display.clearDisplay();

  }

  File data = SD.open("Flight Logger.txt", FILE_WRITE);
  data.println(" "); data.println("Data acquisition started");
  data.close();

}
  

void loop() {
  byte date, time, chars = 0;
  unsigned long age;
  

  satCheck = (gps.satellites());
  display.print("Max Speed: ");
  display.print("Max Height: ");
  display.println(" ");
  display.println(" ");

  display.println(" ");
  display.println(" ");
  speedCheck = float(gps.f_speed_kmph());
  if (speedCheck > speedMax)  {

    speedMax = speedCheck;

  }
  display.setCursor(10, 80); // might have to change later
  display.print(speedMax);

  heightCheck = (gps.f_altitude());
  if (heightCheck > heightMax) {
    heightMax = heightCheck;

  }
  display.setCursor(50, 80); // might have to change later
  display.print(heightMax);

  display.setCursor(100, 80);
  display.print(satCheck);

  int year; 
  byte month, day, hour, minute, second, hundreths; 
  unsigned long age;
  data_write = gps.crack_datetime(&year, &month, &day, &minute, &second, &age);
  
  

  File data = SD.open("Flight Logger.txt", FILE_WRITE);
  data.println(data_write);
  data.close;
  

}
  unsigned long age;

You are trying to declare the same variable in the same scope twice. Delete one of the declarations

  data_write = gps.crack_datetime(&year, &month, &day, &minute, &second, &age);

You are trying to use the data_write variable when it has not been declared. Once that is fixed, check the number of parameters you use when calling the crack_datetime() function. The function is defined as

void TinyGPS::crack_datetime(int *year, byte *month, byte *day, 
  byte *hour, byte *minute, byte *second, byte *hundredths, unsigned long *age)

Note the 8 parameters

I've sat and debugged the code extensively.

No errors now, thank you for the help.

Cheers.

That sounds good and I am sure you will have learned a lot by doing it

Good luck with your project

Yep, learned more in terms of code neatness and debugging.

Thanks for the help and I'm really sorry for troubling you so much

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