Reference to 'File' is ambiguous

Hi, new user here. I’ve been encountering this error message: exit status 1
reference to ‘File’ is ambiguous whenever I compile the code below. The code is meant to take a picture using LS-Y201 camera connected to a NodeMCU with ESP8266-Wifi Module, D3231 RTC module, and a Micro-SD card module with a 16GB Micro-SD card to store the pictures taken with a timestamp. I have attached the code below. Any sort of help or guidance would be greatly appreciated. Thank You.

//17/9/2019 - sketch_sep06a.ino
//18/7/2019 – Snapshot NodeMCU (PCB version 1) with timestamp using RTC

#include <Adafruit_VC0706.h>
#include <SPI.h>
#include<JPEGDecoder.h>
#include <SoftwareSerial.h>
#include <RTClib.h>
#include <Wire.h>
#include <SD.h>

#define SD_CS D8    //For NodeMCU Kit Set version 1
#define DS3231_ADDRESS  0x68  ///< I2C address for DS3231

SoftwareSerial mySerial (D4, D3); //D4-RX, D3 TX For NodeMCU Kit Set version 1
Adafruit_VC0706 cam = Adafruit_VC0706(&mySerial);
File myFile;  // test file
RTC_DS3231 RTC;  // define the Real Time Clock object

char timestamp[30];
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
void setup()
{
  pinMode(SD_CS, OUTPUT);

  Serial.begin(115200);
  Wire.begin ( D1, D2); //D1=SDA D2=SCL
  if (!SD.begin(SD_CS))
  {
    Serial.println("SD card is not inserted");
    return;
  }

  Serial.println("SD Card Present");

  // Try to locate the camera
  if (cam.begin()) {
    Serial.println("Camera Found:");
  } else {
    Serial.println("No camera found?");
    return;
  }

  if (!RTC.begin()) {
    Serial.println("RTC failed");
    while (1);
  };

  snapshot();
  //  ESP.deepSleep(0);  //deep sleep mode until RESET pin is connected to a LOW signal
}

void loop() {

}
//------------------------------------------------------------------------------
void snapshot() {
  // Set the picture size - you can choose one of 640x480, 320x240 or 160x120

  cam.setImageSize(VC0706_320x240);        // medium

  //cam.setImageSize(VC0706_160x120);          // small

  // You can read the size back from the camera (optional, but maybe useful?)
  uint8_t imgsize = cam.getImageSize();
  Serial.print("Image size: ");
  Serial.println(imgsize);
  // Serial.println("640x480");
  Serial.println("320x240");
  // Serial.println("160x120");

  Serial.println("Snap");
  delay(2500);

  if (!cam.takePicture())
  {
    Serial.println("Failed to snap!");
  }
  else
  {
    Serial.println("Picture taken!");
  }
  // Create an image with the name IMGxxxx.JPG
  char filename[13];
  strcpy(filename, "IMG0001.JPG");
  for (int i = 1; i < 10000; i++) {
    filename[3] = '0' + i / 1000;
    filename[4] = '0' + i % 1000 / 10;
    filename[5] = '0' + i % 100 / 10;
    filename[6] = '0' + i % 10;
    // create if does not exist, do not open existing, write, sync after write
    if (! SD.exists(filename)) {
      break;
    }

  }
  // Open the file for writing
  File imgFile = SD.open(filename, FILE_WRITE);
  SdFile::dateTimeCallback(dateTime); //Timestamp for file
  // Get the size of the image (frame) taken
  uint16_t jpglen = cam.frameLength();
  Serial.print("Storing ");
  Serial.print(jpglen, DEC);
  Serial.print(" byte image.");

  int32_t time = millis();
  //pinMode(D8, OUTPUT);
  byte wCount = 0; // For counting # of writes
  while (jpglen > 0) {
    // read 32 bytes at a time;
    uint8_t *buffer;
    uint8_t bytesToRead = min(32, jpglen); // change 32 to 64 for a speedup but may not work with all setups!
    buffer = cam.readPicture(bytesToRead);
    imgFile.write(buffer, bytesToRead);
    if (++wCount >= 64) { // Every 2K, give a little feedback so it doesn't appear locked up
      Serial.print('.');
      wCount = 0;
    }
    //Serial.print("Read ");  Serial.print(bytesToRead, DEC); Serial.println(" bytes");
    jpglen -= bytesToRead;
  }
  imgFile.close();

  time = millis() - time;
  Serial.println("done!");
  Serial.print(time); Serial.println(" ms elapsed");
  Serial.println("Storing Time in Textfile");
  myFile = SD.open("DATES.txt", FILE_WRITE);
  DateTime now = RTC.now();
  myFile.print(filename);
  myFile.print(' ');
  myFile.print(now.year(), DEC);
  myFile.print('/');
  myFile.print(now.month(), DEC);
  myFile.print('/');
  myFile.print(now.day(), DEC);
  myFile.print(" (");
  myFile.print(daysOfTheWeek[now.dayOfTheWeek()]);
  myFile.print(") ");
  myFile.print(now.hour(), DEC);
  myFile.print(':');
  myFile.print(now.minute(), DEC);
  myFile.print(':');
  myFile.print(now.second(), DEC);
  myFile.println();
  myFile.close();
  Serial.println("Done");
}
//------------------------------------------------------------------------------
// call back for file timestamps
void dateTime(uint16_t* date, uint16_t* time) {
  DateTime now = RTC.now();
  sprintf(timestamp, "%02d:%02d:%02d %2d/%2d/%2d \n", now.hour(), now.minute(), now.second(), now.month(), now.day(), now.year() - 2000);
  // return date using FAT_DATE macro to format fields
  *date = FAT_DATE(now.year(), now.month(), now.day());

  // return time using FAT_TIME macro to format fields
  *time = FAT_TIME(now.hour(), now.minute(), now.second());
}

//------------------------------------------------------------------------------

Please do this:

  • When you encounter an error, you’ll see a button on the right side of the orange bar “Copy error messages” in the Arduino IDE (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button…
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum’s code tags markup to your reply.
  • Press “Ctrl + V”. This will paste the error between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

If the text exceeds the forum’s 9000 character limit, save it to a .txt file and post it as an attachment. If you click the “Reply” button here, you will see an “Attachments and other settings” link.