Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: ReadTest example in DS1307 library doesn't compile

  1. #1
    Member
    Join Date
    Feb 2019
    Location
    Vancouver, BC
    Posts
    23

    ReadTest example in DS1307 library doesn't compile

    With no modification, the example doesn't compile. It begins
    Code:
    #include <Wire.h>
    #include <TimeLib.h>
    #include <DS1307RTC.h>
    and that's enough to make the compiler complain. The compiler says
    Code:
    . . . arduino-1.8.8\hardware\teensy\avr\libraries\DS1307RTC\DS1307RTC.cpp:217:11: error: redefinition of 'DS1307RTC RTC'
    DS1307RTC RTC = DS1307RTC(); // create an instance for the user
                      ^
    In file included from ...arduino-1.8.8\hardware\teensy\avr\libraries\DS1307RTC\DS1307RTC.cpp:32:0:
    ... arduino-1.8.8\hardware\teensy\avr\libraries\DS1307RTC\DS1307RTC.h:37:11: note: DS1307RTC RTC previously declared here
    Not surprisingly, the same thing happens with the SetTime example.
    Last edited by Fenichel; 01-13-2020 at 08:12 PM. Reason: added note re SetTime

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,633
    This may be a board or version specific problem ... can you add details ...

    What Teensy is selected for the Board? Which IDE and TeensyDuino version?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,354
    I tried just now, but could not reproduce the problem. I tried for every Teensy model. All compile without error.

    Here's a screenshot of the compile for Teensy 4.0.

    Click image for larger version. 

Name:	sc.png 
Views:	1 
Size:	70.6 KB 
ID:	18738

  4. #4
    Member
    Join Date
    Feb 2019
    Location
    Vancouver, BC
    Posts
    23
    Quote Originally Posted by defragster View Post
    This may be a board or version specific problem ... can you add details ...

    What Teensy is selected for the Board?
    Teensy 3.2/3.1

    Quote Originally Posted by defragster View Post
    Which IDE

    Arduino 1.8.8

    Quote Originally Posted by defragster View Post
    Which TeensyDuino version?
    1.46-beta10

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,633
    Given Paul's post above - it might be resolved with an update to the latest TeensyDuino. 1.48 has been released and 1.49 is in Beta and likely to be released in the next day - with no changes so far from the current 1.49 beta #5.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,354
    Normally I would just say to use the latest version, which I already confirmed works fine.

    But this time, I started wondering if this really was broken back in 1.46-beta10, because these are all very mature libs that haven't changed much in recent years. So I unpacked a fresh copy of Arduino 1.8.8 and installed Teensyduino 1.46-beta10.

    It compiles without any error when I test that old version. Here's a screenshot.

    Click image for larger version. 

Name:	sc2.png 
Views:	3 
Size:	74.5 KB 
ID:	18739

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,354
    My best guess is you make have a local copy of 1 or more of these libs in your {Documents}/Arduino/libraries folder.

    To check, click File > Preference and turn on verbose output while compiling. Then Verify again, and scroll up to see the info Arduino prints about the exact location where it's using each library.

    Or you might have a corrupted copy of the software.

  8. #8
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,633
    With more console output that could be seen where it shows what libraries are used from where.

    IDE's "ctrl+comma" shows file/prefs and 'sketchbook' folder - that folder with be where 'libraries' are when local copies are stored.

  9. #9
    Member
    Join Date
    Feb 2019
    Location
    Vancouver, BC
    Posts
    23
    Quote Originally Posted by PaulStoffregen View Post
    My best guess is you make have a local copy of 1 or more of these libs in your {Documents}/Arduino/libraries folder.
    No, there's nothing in that folder but the readme.txt file that tells me
    Code:
    For information on installing libraries, see: http://arduino.cc/en/Guide/Libraries
    Quote Originally Posted by PaulStoffregen View Post
    To check, click File > Preference and turn on verbose output while compiling. Then Verify again, and scroll up to see the info Arduino prints about the exact location where it's using each library.
    It says it took each of the Wire [version 1.0], Time [version 1.5], and DS1307RTC [version 1.4] libraries from ... arduino-1.8.8\hardware\teensy\avr\libraries
    Quote Originally Posted by PaulStoffregen View Post
    Or you might have a corrupted copy of the software.
    Perhaps. What's the best way to get the latest stable versions of these?

  10. #10
    Member
    Join Date
    Feb 2019
    Location
    Vancouver, BC
    Posts
    23

    solved

    Quote Originally Posted by Fenichel View Post

    It says it took each of the Wire [version 1.0], Time [version 1.5], and DS1307RTC [version 1.4] libraries from ... arduino-1.8.8\hardware\teensy\avr\libraries

    . . .What's the best way to get the latest stable versions of these?
    I have answered my own question. I upgraded Teensyduino to 1.48, and that of course dragged in all the libraries. Now it compiles.

    Thanks to Paul & defragster for prompt patient attention.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •