ESP8266 comilation error: exit status 1

An ESP8266 ESP-12 module can be loaded with example program CheckFlashConfig.ino. Serial monitor output reads “Flash Chip configuration ok”, and actual flash size corresponds with the setting: 4M (1M SPIFFS).

The code is meant to upload BMP280 and HTU21 data to thingspeak. Both sensors to be connected over I2C.
The actual code for uploading is not finished yet, this code is in development stage but there should be no reason as yet for a compilation error.

//https://create.arduino.cc/projecthub/zac-jackson/how-to-make-an-arduino-temperature-data-logger-8f324c

/*
  Make the connections for the SD card module with your Arduino as shown below

    CS of mini SD card module to digital pin 4 on the Arduino

    SCK of mini SD card module to digital pin 13 on the Arduino

    MOSI of mini SD card module to digital pin 11 on the Arduino

    MISO of mini SD card module to digital pin 12 on the Arduino

    VCC of mini SD card module to digital 5V on the Arduino

    GND of mini SD card module to digital GND on the Arduino

  No delay function: currentMillis and previousMillis and millis() are used
*/
/*  Arduino Tutorial - Testing the Adafruits BMP280 Presure & Temperature Sensor
  I2C Connection: Vin: 5V/3V, GND: GND, SCK: A5 (SCL), SDI: A4 (SDA) 
  Dev: Michalis Vasilakis // Date: 8/3/206 // Info: www.ardumotive.com
*/
/*//For SPI connection!
#define BMP_SCK 13
#define BMP_MISO 12
#define BMP_MOSI 11 
#define BMP_CS 10
//Adafruit_BMP280 bme(BMP_CS); // hardware SPI
//Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);
*/

#include <SD.h>
// #include <SPI.h>
#include <DS3231.h>
#include <Wire.h>
#include "Adafruit_HTU21DF.h"
Adafruit_HTU21DF htu = Adafruit_HTU21DF();
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>

//Setup connection of the sensor
Adafruit_BMP280 bmp; // I2C

File data_file;
DS3231  rtc(SDA, SCL);
Time t;
const int lm35_pin = A0;
int temperature;
int chip_select_pin = 4;     //pin 53 for arduino mega 2560: CS for SD card reader
unsigned long previousMillis = 1000;
int previousTime = 0;
int currentTime;
const long interval = 1000; //3600000 = elk uur
int pressure;   //To store the barometric pressure (Pa)
// float temperature;  //To store the temperature (oC)
int altimeter;    //To store the altimeter (m) (you can also use it as a float variable)

#define SQW_RATE_1K 
#define OUTPUT_SQW 

byte setOutput = 0;
int setSQWRate = 2;




void setup() {

  bmp.begin();
  Serial.begin(9600);
  rtc.begin();
  pinMode(lm35_pin, INPUT);
  pinMode(chip_select_pin, OUTPUT);


  if (SD.begin())
  {
    Serial.println("Initialization Successful. Ready to use");
  } else
  {
    Serial.println("Initialization failed. Check your pin connections or change your SD card");
    return;

    if (!htu.begin()) {
      Serial.println("Couldn't find sensor!");
      while (1);
    }
  }
}
void loop() {

  t = rtc.getTime();
  currentTime = t.min, DEC;
  
    if (previousTime != currentTime) {
    previousTime = t.min, DEC;
  


/*  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
*/



    data_file = SD.open("test.txt", FILE_WRITE);
    if (data_file) {
      Serial.print(currentTime);
      Serial.print(" , ");
      data_file.print(",");
      Serial.print(rtc.getTimeStr());
      data_file.print(rtc.getTimeStr());
      Serial.print(" , ");
      data_file.print(",");
      Serial.print(rtc.getDateStr());
      data_file.print(rtc.getDateStr());
      Serial.print(" , ");
      data_file.print(",");
      temperature = analogRead(lm35_pin);
      temperature = (temperature * 500) / 1023;
      Serial.print("Temp: ");
      Serial.print(temperature);
      data_file.print(temperature);
      Serial.print(" , ");
      data_file.print(",");
      pressure = bmp.readPressure() / 100;
      temperature = bmp.readTemperature();
      altimeter = bmp.readAltitude (1050.35); //Change the "1050.35" to your city current barrometric pressure (https://www.wunderground.com)
      Serial.print(bmp.readTemperature());
      data_file.print(bmp.readTemperature());
      data_file.print(",");
      Serial.print(" , ");
      Serial.print(F("Pressure: "));
      Serial.print(pressure);
      data_file.print(pressure);
      data_file.print(",");
      Serial.print(" hPa");
      data_file.print(",");
      Serial.print(" , ");
      Serial.print(htu.readTemperature());
      data_file.print(htu.readTemperature());
      Serial.print(" , ");
      data_file.print(",");
      Serial.print("Hum: "); Serial.println(htu.readHumidity());
      data_file.println(htu.readHumidity());
      data_file.close();
    }

    else {
      Serial.println("error opening your SD card file. Try again");
    }
  }

}

You should know by now that we need the full error message. "exit status 1" gives us almost no useful information.

When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here using code tags.

Please remove unnecessary blank lines from your code before posting to the forum. One or two to separate code into logical sections is fine but large spaces for no reason or random blank lines just make for more scrolling when we're trying to read your code.

pert:
You should know by now that we need the full error message. “exit status 1” gives us almost no useful information.

When you encounter an error you’ll see a button on the right side of the orange bar “Copy error messages”. Click that button. Paste the error in a message here using code tags.

Please remove unnecessary blank lines from your code before posting to the forum. One or two to separate code into logical sections is fine but large spaces for no reason or random blank lines just make for more scrolling when we’re trying to read your code.

Sorry for that; where is the orange bar?
EDIT: found it.

I re-edited the code to remove the SD card. Still same error.
I had to add the error code in attachment, is too big to insert here.

Actual code with this error:

//https://create.arduino.cc/projecthub/zac-jackson/how-to-make-an-arduino-temperature-data-logger-8f324c


  No delay function: currentMillis and previousMillis and millis() are used
*/
/*  Arduino Tutorial - Testing the Adafruits BMP280 Presure & Temperature Sensor
  I2C Connection: Vin: 5V/3V, GND: GND, SCK: A5 (SCL), SDI: A4 (SDA) 
  Dev: Michalis Vasilakis // Date: 8/3/206 // Info: www.ardumotive.com
*/
/*//For SPI connection!
#define BMP_SCK 13
#define BMP_MISO 12
#define BMP_MOSI 11 
#define BMP_CS 10
//Adafruit_BMP280 bme(BMP_CS); // hardware SPI
//Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);
*/

// #include <SD.h>
// #include <SPI.h>
#include <DS3231.h>
#include <Wire.h>
#include "Adafruit_HTU21DF.h"
Adafruit_HTU21DF htu = Adafruit_HTU21DF();
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>

//Setup connection of the sensor
Adafruit_BMP280 bmp; // I2C

//File data_file;
DS3231  rtc(SDA, SCL);
Time t;
const int lm35_pin = A0;
int temperature;
int chip_select_pin = 4;     //pin 53 for arduino mega 2560: CS for SD card reader
unsigned long previousMillis = 1000;
int previousTime = 0;
int currentTime;
const long interval = 1000; //3600000 = elk uur
int pressure;   //To store the barometric pressure (Pa)
// float temperature;  //To store the temperature (oC)
int altimeter;    //To store the altimeter (m) (you can also use it as a float variable)

#define SQW_RATE_1K 
#define OUTPUT_SQW 

byte setOutput = 0;
int setSQWRate = 2;




void setup() {

  bmp.begin();
  Serial.begin(9600);
  rtc.begin();
  pinMode(lm35_pin, INPUT);
 // pinMode(chip_select_pin, OUTPUT);

/*
  if (SD.begin())
  {
    Serial.println("Initialization Successful. Ready to use");
  } else
  {
    Serial.println("Initialization failed. Check your pin connections or change your SD card");
    return;

    if (!htu.begin()) {
      Serial.println("Couldn't find sensor!");
      while (1);
    }
  }
*/  
}

void loop() {

  t = rtc.getTime();
  currentTime = t.min, DEC;

}

error code.txt (27.1 KB)

The first error:

Arduino_SD-card-LM35-DS3231-HTU21D-BMP280:4: error: 'No' does not name a type

   No delay function: currentMillis and previousMillis and millis() are used

   ^

is because your line 4:

  No delay function: currentMillis and previousMillis and millis() are used

was intended to be a comment, but is not.

The next error, and those that follow:

C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\DS3231/DS3231.h:82:3: error: 'Time' does not name a type

   Time getTime();

   ^

I believe is caused by the infamous Time.h/time.h bug. Typically this can be solved by updating to the latest version of your DS3231 library. If you'll post a link to where you downloaded the DS3231 library from (or give the full name if installed via Library manager) I could provide more information.

pert:
(…)

The next error, and those that follow:

C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\DS3231/DS3231.h:82:3: error: 'Time' does not name a type

Time getTime();

^



I believe is caused by the infamous Time.h/time.h bug. Typically this can be solved by updating to the latest version of your DS3231 library. If you'll post a link to where you downloaded the DS3231 library from (or give the full name if installed via Library manager) I could provide more information.

The DS3231 library is from Andrew Wickert, Eric Ayers, Jean-Claude Wippler version 1.0.2, downloaded from Rinky-dink Electronics, Henning Karlsen.
I did not know there is an infamous bug there, I will look it up.
Any alternative for that function or library (I do have these libraries installed:
DS3231
MD_DS3231
RTC
RTClib
RTCtime
Sodaq_DS3231
uRTCLib
DS3231RTC
RTC by Makuna
RTClib
RTClibExtended
Time (by Michael Margolis version 1.5.0)

brice3010:
The DS3231 library is from Andrew Wickert, Eric Ayers, Jean-Claude Wippler version 1.0.2, downloaded from Rinky-dink Electronics, Henning Karlsen.

No, that's not the one you're using. The way I know is that version of that library does not contain the line 82 from your error message:

C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\DS3231/DS3231.h:82:3: error: 'Time' does not name a type

   Time getTime();

As you can see:

Also, this line of the output:

Bibliotheek DS3231 in map: C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\DS3231 (legacy) wordt gebruikt

tells me that the library you're using doesn't contain a library.properties file, as the library you claim to be using does.

How do I best go about to find out which library is used? It should be in the list I quoted in my previous post, shouldn't it?

The output tells you which one is being used:

Bibliotheek DS3231 in map: C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\DS3231 (legacy) wordt gebruikt

Does the library.properties file have a .cpp extension? If so I can find these in all my DS3231 libraries.

I read DS3231/DS3231.h at v1.0.2 · NorthernWidget/DS3231 · GitHub so this refers to the way time is set: is that the issue with my code?

brice3010:
Does the library.properties file have a .cpp extension?

No, it’s a file named library.properties. The extension is .properties.

brice3010:
is that the issue with my code?

It’s impossible for me to say what the problem is with your code because I can’t look at this mysterious DS3231 library. You found it somewhere online, downloaded it, then installed it. I know you didn’t install it via Library Manager (Sketch > Include Libraries > Manage Libraries) because those libraries all have a library.properties file. I don’t understand how you can be so unaware of what you’re doing that you don’t remember installing this library. It looks like you just took the shotgun approach and installed every DS3231 library you could find.

I suppose the root of the problem is that the tutorial you got the code from:
https://create.arduino.cc/projecthub/zac-jackson/how-to-make-an-arduino-temperature-data-logger-8f324c
didn’t bother to document which DS3231 library they used. Why don’t you comment on that project to ask them to do so?

pert:
No, it's a file named library.properties. The extension is .properties.
It's impossible for me to say what the problem is with your code because I can't look at this mysterious DS3231 library. You found it somewhere online, downloaded it, then installed it. I know you didn't install it via Library Manager (Sketch > Include Libraries > Manage Libraries) because those libraries all have a library.properties file. I don't understand how you can be so unaware of what you're doing that you don't remember installing this library. It looks like you just took the shotgun approach and installed every DS3231 library you could find.

.."shotgun approach": quite right, I remember having a few time extracted the zip file in my libraries directory for direct use without using the Library Manager. I was not aware of the implications. I also found so many DS3231 libraries that I indeed just installed whatever seemed appropriate the previous few months. Lesson learned now.

Would it help if I delete all library folders that do not contain this library.proprties file?

And reinstall through the Library Manager?

pert:
I suppose the root of the problem is that the tutorial you got the code from:
https://create.arduino.cc/projecthub/zac-jackson/how-to-make-an-arduino-temperature-data-logger-8f324c
didn't bother to document which DS3231 library they used. Why don't you comment on that project to ask them to do so?

I will.

The best way to move forward is to find out which DS3231 library that code was written for. Since that wasn’t documented, you need to infer it from how the parts of the sketch that use the library are written. The first clue is the include file: DS3231.h. So that rules out any DS3231 library that does not contain a file of that name. After that you have the API of the library used by the sketch. You know it has a class named DS3231. You know it has functions named begin and getTime. So you would need to find a library that fits all those, then see if it works. There’s a good chance that there is one most popular DS3231 library and that’s the one most likely to have been used. I have never worked with the DS3231 so I don’t know.

Really this is a simple sketch and you could easily adapt it to use any DS3231 library, that might be less work in the end and would allow you to use the library of your preference.

I did find a library in my libraries folder that fits all these descriptions (no library.properties, beginTime and getTime functions, and called DS3231.h): from Rinky-DinkElectronics. I will delete that from my library folder and install the one from Eric Ayers.
I also changed my code to use RtcDS3231.h and problem solved, compilation ok.
Thanks for your valuable assistance!