Problem compiling code using RTClib.h

I have been working on a datalogger with a timestamp and started by looking at example code provided by Sparkfun on the DS1307 product page. I have not been able to get any of the examples to compile. A long list of compile errors are given. I am using Arduino ERW 1.04 with the RTClib available by following links from the Sparkfun site so assume it is the right version of RTClib (I have found several others and even tried some of those). A typical compiler errors are:

In file included from C:\Users\Fader\Documents\Arduino\libraries\RTClib/RTC_DS1307.h:7,

from C:\Users\Fader\Documents\Arduino\libraries\RTClib\RTC_DS1307.cpp:13:

C:\Users\Fader\Documents\Arduino\libraries\RTClib/RTClib.h:5: error: redefinition of ‘class DateTime’

C:\Users\Fader\Documents\Arduino\libraries\RTClib/RTClib.h:5: error: previous definition of ‘class DateTime’

C:\Users\Fader\Documents\Arduino\libraries\RTClib/RTClib.h:29: error: redefinition of ‘class RTC_DS1307’

C:\Users\Fader\Documents\Arduino\libraries\RTClib/RTClib.h:29: error: previous definition of ‘class RTC_DS1307’

C:\Users\Fader\Documents\Arduino\libraries\RTClib\RTC_DS1307.cpp: In static member function ‘static void RTC_DS1307::adjust(const DateTime&)’:

C:\Users\Fader\Documents\Arduino\libraries\RTClib\RTC_DS1307.cpp:48: error: ‘bin2bcd’ was not declared in this scope

C:\Users\Fader\Documents\Arduino\libraries\RTClib\RTC_DS1307.cpp: In static member function ‘static DateTime RTC_DS1307::now()’:

C:\Users\Fader\Documents\Arduino\libraries\RTClib\RTC_DS1307.cpp:66: error: ‘bcd2bin’ was not declared in this scope

If anyone can point out to me what I am missing I would appreciate the help.

Thanks.

The error messages are telling you that there are duplicate definitions for certain constants, and that you are missing the code for the function bcd2bin. Look through ALL the source files to see why.

Thanks, I had a good look at the files in the RTClib folder and found that I had both “RTClib.h/cpp” and “DS1307.h/.cpp” in the folder, I think the compiler was trying to take definitions from both sets even though only RTClib.h was called in the program. Anyway, deleting the DS1307 files did the trick.