Header Files Problems

I can not get the DS3231 code to work because of header file problems. I followed the following link but no success.


I followed exactly what did this paper told me but no luck so far. The errors are as follows

RTC_Test.cpp.o: In function `setup':
C:\arduino-1.6.5-r5/RTC_Test.ino:26: undefined reference to `DS3231::setSecond(unsigned char)'
C:\arduino-1.6.5-r5/RTC_Test.ino:27: undefined reference to `DS3231::setMinute(unsigned char)'
C:\arduino-1.6.5-r5/RTC_Test.ino:28: undefined reference to `DS3231::setHour(unsigned char)'
C:\arduino-1.6.5-r5/RTC_Test.ino:29: undefined reference to `DS3231::setDoW(unsigned char)'
C:\arduino-1.6.5-r5/RTC_Test.ino:30: undefined reference to `DS3231::setDate(unsigned char)'
C:\arduino-1.6.5-r5/RTC_Test.ino:31: undefined reference to `DS3231::setMonth(unsigned char)'
C:\arduino-1.6.5-r5/RTC_Test.ino:32: undefined reference to `DS3231::setYear(unsigned char)'
RTC_Test.cpp.o: In function `ReadDS3231()':
C:\arduino-1.6.5-r5/RTC_Test.ino:39: undefined reference to `DS3231::getSecond()'
C:\arduino-1.6.5-r5/RTC_Test.ino:40: undefined reference to `DS3231::getMinute()'
C:\arduino-1.6.5-r5/RTC_Test.ino:41: undefined reference to `DS3231::getHour(bool&, bool&)'
C:\arduino-1.6.5-r5/RTC_Test.ino:42: undefined reference to `DS3231::getDate()'
C:\arduino-1.6.5-r5/RTC_Test.ino:43: undefined reference to `DS3231::getMonth(bool&)'
C:\arduino-1.6.5-r5/RTC_Test.ino:44: undefined reference to `DS3231::getYear()'
C:\arduino-1.6.5-r5/RTC_Test.ino:46: undefined reference to `DS3231::getTemperature()'
RTC_Test.cpp.o: In function `__static_initialization_and_destruction_0':
C:\arduino-1.6.5-r5/RTC_Test.ino:11: undefined reference to `DS3231::DS3231()'
collect2.exe: error: ld returned 1 exit status
Multiple libraries were found for "DS3231.h"
 Used: C:\Users\tr\Documents\Arduino\libraries\DS3231
 Not used: C:\arduino-1.6.5-r5\libraries\DS3231
Error compiling.

I am using Arduino 1.6.5

Can anyone tell me how to specify the head file directory path in Arduino

Can anyone tell me how to specify the head file directory path in Arduino

I don’t think you can with libraries. The Arduino IDE has a set order of precedence it uses when the same header filename occurs in multiple libraries. In this case the library in C:\Users\tr\Documents\Arduino\libraries\DS3231 will always be chosen over C:\arduino-1.6.5-r5\libraries\DS3231. If you change the folder name from C:\Users\tr\Documents\Arduino\libraries\DS3231 to something like C:\Users\tr\Documents\Arduino\libraries\DS3231_2 then the library in C:\arduino-1.6.5-r5\libraries\DS3231 will be chosen instead because preference is given to the header filename that matches the folder name. Note that you’re not supposed to install libraries to C:\arduino-1.6.5-r5\libraries\ because then you will need to reinstall every time you update the IDE. If you want to work with multiple versions of a library one way is to use git branches, then you can just checkout the branch you want to use before compiling. You could also create a second sketchbook location like C:\Users\tr\Documents\Arduino2\ and put one version of the library in each sketchbook and then switch the sketchbook location back and forth in File > Preferences.