Go Down

Topic: moving library from 0017 to 1.0 (Read 898 times) previous topic - next topic


  I am running on a PC using (mainly) ATMega644P micros.  An application running well under Arduino 17 is failing to compile under 1.0.

  I can replicate the problem with one private library and a tiny test program.  In its entirety, the library's header is
Code: [Select]
/* DS1307 library, from old include file */
#include "Arduino.h"

#define DS1307_SecondsReg    0            // followed by min, hrs, DOW (1-based!), Day, Mo, Yr
#define DS1307_YearReg       6       
#define DS1307_1st           DS1307_SecondsReg
#define DS1307_Last          DS1307_YearReg
#define DS1307_NBytes        DS1307_Last - DS1307_1st + 1

#ifndef DS1307_h
  #define DS1307_h
  class tDateTime
    {  private:
         void AssembleOneElement(char* S, int Index, int Value);
         unsigned long Year;
         unsigned long Month;
         unsigned long Day;
         unsigned long Hour;
         unsigned long Minute;
         unsigned long Second;
                                 //           11
                                 // 012345678901
         char TimeAsString[13];  // YYMMDDHHmmSS";
         void Assemble(void);
         void AssembleIntoString(char* S);
         int  DaysInMonth(int M, int Y);
         void Disassemble(void);
         void DisassembleFromString(char* S);
         void Normalize(void);
         unsigned long SecondsSince1999();
    }; // tDateTime
  class DS1307
    { private:
        int  BCDToInt(byte B);
        void FillAsciiBigTime(int Index, int Value);
        byte IntToBCD(int N);
        byte ReadBuffer[DS1307_NBytes];
        void SetControlRegister();
        tDateTime TheDateTime;
        int WeekdayM0;   // Day of week, Monday = 0, Tuesday = 1, ..., Sunday = 6
                               //           11
                               // 012345678901
        char AsciiBigTime[13]; // YYMMDDHHmmSS";
        void ReadTime(void);
        void SetAsciiBigTime(unsigned long AddedSeconds);  // changes only printable form
        void SetTime();                                    // changes registers
        void setup_1307();
    }; // DS1307

Code: [Select]
  { TheDateTime = tDateTime();
  } // create object

appropriately in DS1307.cpp.  The test program has a few declarations before
Code: [Select]
#include "G:\hardware\freestanding\Arduino 1.0\libraries\DS1307\DS1307.h"
DS1307 TheDS1307 = DS1307();

but that's enough to get the compilation to fail.  In response to the second quoted line, the compiler complains
Code: [Select]
Test_DS1307.cpp.o: In function '_static_initialization_and_destruction_0':

C:\Users\RobertT~1.FEN\AppData\Local\Temp\build6736133756654905411.tmp/Test_DS1307.cpp:12: undefined reference to 'DS1307::DS1307()'

  My guess is that the problem is somehow related to a change in the Arduino IDE's perverse notions about how directories must be structured, but various experiments moving the library from one directory to another haven't helped.  I am aware that the Arduino software frequently fails to clean up after itself, but deleting the object files (and, indeed, the whole applet directory) doesn't help either.

  Any help will be appreciated.


Why not replace
Code: [Select]
DS1307 TheDS1307 = DS1307();

Code: [Select]
DS1307 TheDS1307 ();

while you're at it?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Insert Quote
Why not replace

DS1307 TheDS1307 = DS1307();


DS1307 TheDS1307 ();

while you're at it?

  My C++ programming style is borrowed from Delphi, in which I've done most of my programming for the last 20 years or so.  In Delphi, declaration and instantiation of objects are generally separated.  Here, the suggested stylistic change doesn't change the compilability of my test code.

Go Up