Fatal error during compilation

In file included from C:\Users\ashish\Desktop\study\Trigger_Relay_with_DS3231_RTC\Trigger_Relay_with_DS3231_RTC.ino:2:0:
C:\Users\ashish\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/DS3231.h:27:11: fatal error: hardware/avr/HW_AVR_defines.h: No such file or directory
#include "hardware/avr/HW_AVR_defines.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

pls help me to solve tis issue that i am facingUse code tags to format code for the forum

Welcome to the forum

As your topic does not relate directly to the installation or operation of the IDE it has been moved to the Programming Questions category of the forum

Which Arduino board are you compiling for ?
Does it use an AVR processor ?

That file is not part of the IDE, it is part of the DS3231 library.

How did you install the library?

I am using arduino uno r3

Arduino uno r3

How did you end up with that file in the core directory?

3rd party libraries should be in the libraries directory under the sketchbook directory; you can find the sketchbook directory in the preferences (file/preferences).


did you mean to say i have to remove it from this file location which is shown in above screenshot and then i have to save the same ds3231.h and ds3231.cpp in that file location which shown below

Yes

But I actually asked how they got in the place where they are in the first place :wink:

Most people dont fiddle around with the core unless they are suckers for punishment (like me :slight_smile:)

2 Likes

do you want to know how i found core location ?

pls help me to find its solution can anyone help me by a short video or by screenshot or just compile the code from your side in your pc that i am trying here but not if working if you run this code and worked in your tell me pls

here is code

#include <DS3231.h>


int Relay = 4;

DS3231 rtc;
Time t;

const int OnHour = 12;
const int OnMin  = 24;
const int OffHour= 12;
const int OffMin = 25;

void setup() {
  Serial.begin(115200);
  rtc.begin();
  pinMode(Relay, OUTPUT);
  digitalWrite(Relay, LOW);
}

void loop() {
  t = rtc.getTime();
  Serial.print(t.hour);
  Serial.print(" hour(s), ");
  Serial.print(t.min);
  Serial.print(" minute(s)");
  Serial.println(" ");
  delay (1000);
  
  if(t.hour == OnHour && t.min == OnMin){
    digitalWrite(Relay,HIGH);
    Serial.println("LIGHT ON");
    }
    
    else if(t.hour == OffHour && t.min == OffMin){
      digitalWrite(Relay,LOW);
      Serial.println("LIGHT OFF");
    }
}

No, I would like to know why you have 3rd party library files in there.

Buddy if you can do any help then pls help can you compile that program that i had in previous thread and if it is working in your system then pls tell me how it works which library you are using and where you place that library (means i want to know path location)
and you last question's answer is i used that 3 party library because in arduino ide, ds3231 library also not working properly thats why i search online and found rinky dink ds3231 now the whole code compiled without any error showing before this library i got in many of the line give error,
now pls if you can try this from your side then pls help
code here shown below


#include <DS3231.h>


int Relay = 4;

DS3231 rtc(SDA, SCL);
Time t;

const int OnHour = 12;
const int OnMin  = 24;
const int OffHour= 12;
const int OffMin = 25;

void setup() {
  Serial.begin(115200);
  rtc.begin();
  pinMode(Relay, OUTPUT);
  digitalWrite(Relay, LOW);
}

void loop() {
  t = rtc.getTime();
  Serial.print(t.hour);
  Serial.print(" hour(s), ");
  Serial.print(t.min);
  Serial.print(" minute(s)");
  Serial.println(" ");
  delay (1000);
  
  if(t.hour == OnHour && t.min == OnMin){
    digitalWrite(Relay,HIGH);
    Serial.println("LIGHT ON");
    }
    
    else if(t.hour == OffHour && t.min == OffMin){
      digitalWrite(Relay,LOW);
      Serial.println("LIGHT OFF");
    }
}

Thank you for trying to use code tags but you did it wrong so I have fixed it for you

In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

Compare the program from post #11 with post #13. The program from post #13 compiles on my system, post #11 does not. The reason might be that the parts that you used came from a different example and uses a different library.

If you haven't done so yet, delete the DS3231 files that show in your first screenshot in post #8. The DS3231 in the second screenshot should be the RinkyDink DS3231 library. You can verify by opening one of the two files in e.g. notepad and the beginning will look like

/*
  DS3231.cpp - Arduino/chipKit library support for the DS3231 I2C Real-Time Clock
  Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved

Do not make changes, just close the file again.

is #13 code compiled in your system without any error how brother oki will try again then came back to you

still showing error


pls help me with screenshot can you make a small clip of or screen
recording

Please do not post pictures of code and errors

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

The cause of the error seems quite clear. The compiler cannot find the DS3231 library

Is it installed on your PC and, if so, which directory is it located in ?

What is in the DS3231 directory in the second screenshot of post #8? This is the extracted RinkyDink DS3231 library directory on my system.

DS3231/
β”œβ”€β”€ Documentation
β”‚   β”œβ”€β”€ DS3231.pdf
β”‚   └── version.txt
β”œβ”€β”€ DS3231.cpp
β”œβ”€β”€ DS3231.h
β”œβ”€β”€ examples
β”‚   β”œβ”€β”€ Arduino
β”‚   β”‚   β”œβ”€β”€ DS3231_Serial_Easy
β”‚   β”‚   β”‚   └── DS3231_Serial_Easy.ino
β”‚   β”‚   β”œβ”€β”€ DS3231_Serial_Hard
β”‚   β”‚   β”‚   └── DS3231_Serial_Hard.ino
β”‚   β”‚   β”œβ”€β”€ DS3231_Temperature
β”‚   β”‚   β”‚   └── DS3231_Temperature.ino
β”‚   β”‚   └── DS3231_UnixTime
β”‚   β”‚       └── DS3231_UnixTime.ino
β”‚   └── chipKit
β”‚       β”œβ”€β”€ DS3231_Serial_Easy
β”‚       β”‚   └── DS3231_Serial_Easy.pde
β”‚       β”œβ”€β”€ DS3231_Serial_Hard
β”‚       β”‚   └── DS3231_Serial_Hard.pde
β”‚       β”œβ”€β”€ DS3231_Temperature
β”‚       β”‚   └── DS3231_Temperature.pde
β”‚       └── DS3231_UnixTime
β”‚           └── DS3231_UnixTime.pde
β”œβ”€β”€ hardware
β”‚   β”œβ”€β”€ arm
β”‚   β”‚   β”œβ”€β”€ HW_ARM_defines.h
β”‚   β”‚   └── HW_ARM.h
β”‚   β”œβ”€β”€ avr
β”‚   β”‚   β”œβ”€β”€ HW_AVR_defines.h
β”‚   β”‚   └── HW_AVR.h
β”‚   └── pic32
β”‚       β”œβ”€β”€ HW_PIC32_defines.h
β”‚       └── HW_PIC32.h
β”œβ”€β”€ keywords.txt
└── License
    β”œβ”€β”€ License - CC BY-NC-SA 3.0 - Legal.pdf
    └── License - CC BY-NC-SA 3.0 - Summary.pdf

17 directories, 21 files