2

I'm an Arduino newbie, no background in C/C++, needing help to understand Arduino IDE verbose output about compiler errors. My searching failed to find suitable info - have I missed a relevant guide?

Below example of compiler errors produced when I try to compile Example sketch (TestRTC) from a downloaded library. I assume this Example code is valid. Guessing that my errors relate to missing components. The library was one of two recommended in answer to question. I used IDE Manage Libraries to install from downloaded zip files. Windows file manager shows both library folders are present.

In example below: Which components did the compiler find/not find? Where did compiler search for needed components? What other useful info could be gleaned from this error output?

Would be very grateful for general advice on interpreting error text as well as this particular example. Many thanks.

Arduino: 1.6.11 (Windows 7), Board: "Arduino/Genuino Uno"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\jdocs\00_arduino\duinosketches\libraries -fqbn=arduino:avr:uno -ide-version=10611 -build-path C:\Users\Jules\AppData\Local\Temp\build8b85ae284f2ad840f4c667e76a0588ca.tmp -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\jdocs\00_arduino\duinosketches\libraries -fqbn=arduino:avr:uno -ide-version=10611 -build-path C:\Users\Jules\AppData\Local\Temp\build8b85ae284f2ad840f4c667e76a0588ca.tmp -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino
Using board 'uno' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Jules\AppData\Local\Temp\build8b85ae284f2ad840f4c667e76a0588ca.tmp\sketch\TestRTC.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Users\Jules\AppData\Local\Temp\build8b85ae284f2ad840f4c667e76a0588ca.tmp\sketch\TestRTC.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "-IC:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master" "C:\Users\Jules\AppData\Local\Temp\build8b85ae284f2ad840f4c667e76a0588ca.tmp\sketch\TestRTC.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "-IC:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master" "C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\Wire.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "-IC:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master" "C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\utility\twi.c" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "-IC:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master" "C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master\DS3232RTC.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "-IC:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master" "C:\Users\Jules\AppData\Local\Temp\build8b85ae284f2ad840f4c667e76a0588ca.tmp\sketch\TestRTC.ino.cpp" -o "nul"
Generating function prototypes...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "-IC:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master" "C:\Users\Jules\AppData\Local\Temp\build8b85ae284f2ad840f4c667e76a0588ca.tmp\sketch\TestRTC.ino.cpp" -o "C:\Users\Jules\AppData\Local\Temp\build8b85ae284f2ad840f4c667e76a0588ca.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino10/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\Jules\AppData\Local\Temp\build8b85ae284f2ad840f4c667e76a0588ca.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "-IC:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master" "C:\Users\Jules\AppData\Local\Temp\build8b85ae284f2ad840f4c667e76a0588ca.tmp\sketch\TestRTC.ino.cpp" -o "C:\Users\Jules\AppData\Local\Temp\build8b85ae284f2ad840f4c667e76a0588ca.tmp\sketch\TestRTC.ino.cpp.o"
In file included from C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino:49:0:

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h:82:22: error: 'tmElements_t' has not been declared

     static void read(tmElements_t &tm);

                      ^

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h:83:23: error: 'tmElements_t' has not been declared

     static void write(tmElements_t &tm);

                       ^

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h:84:27: error: 'tmElements_t' has not been declared

     static void writeTime(tmElements_t &tm);

                           ^

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h:85:27: error: 'tmElements_t' has not been declared

     static void writeDate(tmElements_t &tm);

                           ^

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h:87:61: error: 'tmElements_t' has not been declared

     static void readAlarm(uint8_t alarm, alarmMode_t &mode, tmElements_t &tm);

                                                             ^

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h:88:61: error: 'tmElements_t' has not been declared

     static void writeAlarm(uint8_t alarm, alarmMode_t mode, tmElements_t tm);

                                                             ^

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h:110:24: error: 'tmElements_t' has not been declared

     static void _wTime(tmElements_t &tm);

                        ^

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h:111:24: error: 'tmElements_t' has not been declared

     static void _wDate(tmElements_t &tm);

                        ^

TestRTC:79: error: 'tmElements_t' does not name a type

 inline uint8_t monthLength(const tmElements_t *date)

                           ^

TestRTC:297: error: 'tmElements_t' does not name a type

 void printAlarm(byte alarmNum, const alarmMode_t mode, const tmElements_t time)

                                                              ^

TestRTC:79: error: 'tmElements_t' does not name a type

 inline uint8_t monthLength(const tmElements_t *date)

                                  ^

C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino: In function 'uint8_t monthLength(const int*)':

TestRTC:81: error: request for member 'Month' in '* date', which is of non-class type 'const int'

     if (date->Month != 2 || !isLeapYear(date->Year))

               ^

TestRTC:81: error: request for member 'Year' in '* date', which is of non-class type 'const int'

     if (date->Month != 2 || !isLeapYear(date->Year))

                                               ^

TestRTC:82: error: request for member 'Month' in '* date', which is of non-class type 'const int'

         return monthLengths[date->Month - 1];

                                   ^

C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino: In function 'void cmdTime(const char*)':

TestRTC:213: error: 'tmElements_t' was not declared in this scope

     tmElements_t tm;

     ^

TestRTC:218: error: expected unqualified-id before '.' token

         tm.Hour = readField(args, posn, 23);

           ^

TestRTC:219: error: expected unqualified-id before '.' token

         tm.Minute = readField(args, posn, 59);

           ^

TestRTC:221: error: expected unqualified-id before '.' token

             tm.Second = readField(args, posn, 59);

               ^

TestRTC:223: error: expected unqualified-id before '.' token

             tm.Second = 0;

               ^

TestRTC:224: error: expected primary-expression before '.' token

         if (tm.Hour == 99 || tm.Minute == 99 || tm.Second == 99) {

               ^

TestRTC:224: error: expected primary-expression before '.' token

         if (tm.Hour == 99 || tm.Minute == 99 || tm.Second == 99) {

                                ^

TestRTC:224: error: expected primary-expression before '.' token

         if (tm.Hour == 99 || tm.Minute == 99 || tm.Second == 99) {

                                                   ^

TestRTC:228: error: expected primary-expression before ')' token

         RTC.writeTime(tm);

                         ^

TestRTC:233: error: expected primary-expression before ')' token

     RTC.read(tm);

                ^

TestRTC:234: error: expected primary-expression before '.' token

     printDec2(tm.Hour);

                 ^

TestRTC:236: error: expected primary-expression before '.' token

     printDec2(tm.Minute);

                 ^

TestRTC:238: error: expected primary-expression before '.' token

     printDec2(tm.Second);

                 ^

C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino: In function 'void cmdDate(const char*)':

TestRTC:245: error: 'tmElements_t' was not declared in this scope

     tmElements_t tm;

     ^

TestRTC:256: error: expected unqualified-id before '.' token

         tm.Day = (byte)(value % 100);

           ^

TestRTC:257: error: expected unqualified-id before '.' token

         tm.Month = (byte)((value / 100) % 100);

           ^

TestRTC:258: error: expected unqualified-id before '.' token

         tm.Year = CalendarYrToTm( (unsigned int)(value / 10000) );

           ^

TestRTC:259: error: expected primary-expression before '.' token

         if (tm.Month < 1 || tm.Month > 12) {

               ^

TestRTC:259: error: expected primary-expression before '.' token

         if (tm.Month < 1 || tm.Month > 12) {

                               ^

TestRTC:263: error: expected primary-expression before ')' token

         uint8_t len = monthLength(&tm);

                                      ^

TestRTC:264: error: expected primary-expression before '.' token

         if (tm.Day < 1 || tm.Day > len) {

               ^

TestRTC:264: error: expected primary-expression before '.' token

         if (tm.Day < 1 || tm.Day > len) {

                             ^

TestRTC:269: error: expected primary-expression before ')' token

         RTC.writeDate(tm);

                         ^

TestRTC:274: error: expected primary-expression before ')' token

     RTC.read(tm);

                ^

TestRTC:275: error: expected primary-expression before '.' token

     if (tm.Wday > 0) Serial.print(days[tm.Wday - 1]);

           ^

TestRTC:275: error: expected primary-expression before '.' token

     if (tm.Wday > 0) Serial.print(days[tm.Wday - 1]);

                                          ^

TestRTC:276: error: expected primary-expression before '.' token

     Serial.print(tm.Day, DEC);

                    ^

TestRTC:277: error: expected primary-expression before '.' token

     Serial.print(months[tm.Month - 1]);

                           ^

TestRTC:278: error: expected primary-expression before '.' token

     Serial.println(tmYearToCalendar(tm.Year), DEC);  // NB! Remember tmYearToCalendar()

                                       ^

TestRTC:278: error: 'tmYearToCalendar' was not declared in this scope

     Serial.println(tmYearToCalendar(tm.Year), DEC);  // NB! Remember tmYearToCalendar()

                                            ^

C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino: At global scope:

TestRTC:297: error: 'tmElements_t' does not name a type

 void printAlarm(byte alarmNum, const alarmMode_t mode, const tmElements_t time)

                                                              ^

C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino: In function 'void printAlarm(byte, alarmMode_t, int)':

TestRTC:324: error: request for member 'Second' in 'time', which is of non-class type 'const int'

             printDec2(time.Second);

                            ^

TestRTC:328: error: request for member 'Minute' in 'time', which is of non-class type 'const int'

             printDec2(time.Minute);

                            ^

TestRTC:330: error: request for member 'Second' in 'time', which is of non-class type 'const int'

             printDec2(time.Second);

                            ^

TestRTC:336: error: request for member 'Day' in 'time', which is of non-class type 'const int'

               Serial.print(time.Day);

                                 ^

TestRTC:340: error: request for member 'Wday' in 'time', which is of non-class type 'const int'

               Serial.print(days[time.Wday - 1]);

                                      ^

TestRTC:343: error: request for member 'Hour' in 'time', which is of non-class type 'const int'

             printDec2(time.Hour);

                            ^

TestRTC:345: error: request for member 'Minute' in 'time', which is of non-class type 'const int'

             printDec2(time.Minute);

                            ^

TestRTC:347: error: request for member 'Second' in 'time', which is of non-class type 'const int'

             printDec2(time.Second);

                            ^

C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino: In function 'void cmdAlarms(const char*)':

TestRTC:359: error: 'tmElements_t' was not declared in this scope

     tmElements_t time;

     ^

TestRTC:362: error: no matching function for call to 'DS3232RTC::readAlarm(byte&, alarmMode_t&, time_t (&)(time_t*))'

         RTC.readAlarm(alarmNum, mode, time);

                                           ^

C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino:362:43: note: candidate is:

In file included from C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino:49:0:

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h:87:17: note: static void DS3232RTC::readAlarm(uint8_t, alarmMode_t&, int&)

     static void readAlarm(uint8_t alarm, alarmMode_t &mode, tmElements_t &tm);

                 ^

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h:87:17: note:   no known conversion for argument 3 from 'time_t(time_t*) {aka long unsigned int(long unsigned int*)}' to 'int&'

C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino: In function 'void cmdAlarm(const char*)':

TestRTC:373: error: 'tmElements_t' was not declared in this scope

     tmElements_t time;

     ^

TestRTC:391: error: request for member 'Hour' in 'time', which is of non-class type 'time_t(time_t*) {aka long unsigned int(long unsigned int*)}'

             time.Hour = readField(args, posn, 23);

                  ^

TestRTC:392: error: request for member 'Minute' in 'time', which is of non-class type 'time_t(time_t*) {aka long unsigned int(long unsigned int*)}'

             time.Minute = readField(args, posn, 59);

                  ^

TestRTC:393: error: request for member 'Hour' in 'time', which is of non-class type 'time_t(time_t*) {aka long unsigned int(long unsigned int*)}'

             if (time.Hour == 99 || time.Minute == 99) {

                      ^

TestRTC:393: error: request for member 'Minute' in 'time', which is of non-class type 'time_t(time_t*) {aka long unsigned int(long unsigned int*)}'

             if (time.Hour == 99 || time.Minute == 99) {

                                         ^

TestRTC:417: error: no matching function for call to 'DS3232RTC::readAlarm(byte&, alarmMode_t&, time_t (&)(time_t*))'

     RTC.readAlarm(alarmNum, mode, time);

                                       ^

C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino:417:39: note: candidate is:

In file included from C:\Users\Jules\AppData\Local\Temp\arduino_modified_sketch_461291\TestRTC.ino:49:0:

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h:87:17: note: static void DS3232RTC::readAlarm(uint8_t, alarmMode_t&, int&)

     static void readAlarm(uint8_t alarm, alarmMode_t &mode, tmElements_t &tm);

                 ^

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h:87:17: note:   no known conversion for argument 3 from 'time_t(time_t*) {aka long unsigned int(long unsigned int*)}' to 'int&'

Multiple libraries were found for "DS3232RTC.h"
 Used: C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master
 Not used: C:\Program Files (x86)\Arduino\libraries\RTC
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire 
Using library DS3232RTC-master in folder: C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master (legacy)
exit status 1
'tmElements_t' does not name a type
1
  • The problem is that one error leads to 100’s of error messages. But usually you can trace it back to one single problem. After fixing one thing, you should re-compile, and check what errors persist (or are new ;p). You shouldn't always take the errors too literally, just re check the parts around the error and then the parts related to that. – Paul Sep 27 '16 at 19:22
6

As @st2000 said, it's best to start with the first error shown as that error may be causing other errors that will go away once you fix the first one. You should be aware of the difference between warnings and errors. Warnings may or may not be related to the error preventing your code from compiling so I'd just focus on the error at first. So scroll the console window all the way up and then start reading down until you find the first error. If the output is very long you may find it useful to copy the output and paste into a text editor then do a search for the word error, starting from the beginning of the file.

In your compiler output the first error listed is:

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h:82:22: error: 'tmElements_t' has not been declared

     static void read(tmElements_t &tm);

                      ^

The first thing we can learn from this is the file where the error occurred:

C:\jdocs\00_arduino\duinosketches\libraries\DS3232RTC-master/DS3232RTC.h

The next part of the error message is:

:82:22

This means that the error occurred at line 82, column 22 of the file DS3232RTC.h. This makes it easy for you to find that code in the file. Any decent text editor will show the current line number and column at the cursor.

The next part of the error message is a description of the problem:

error: 'tmElements_t' has not been declared

Often you may not understand exactly what it means. This is where your favorite search engine comes in handy. You can try searching for "'tmElements_t' has not been declared". The 'tmElements_t' part is very specific to this code so you will get less results but they may lead you to others who have had the same problem and the solutions they found.

Searching for the general error "has not been declared" will give you a broader description of what the compiler is trying to tell you.

Finally is the actual code line:

 static void read(tmElements_t &tm);

                  ^

The carat shows the column number of the error.

Unfortunately the actual bug may often be in previous code so this isn't as simple as it may seem.

Now lets talk about your specific issue. A search for "'tmElements_t' has not been declared" does yield some results from others having similar problems but you will probably find after going through their solutions that none of them fix the error. This is because the error is caused by a recent update to a new version of avr-libc in Arduino IDE 1.6.10/Arduino AVR Boards 1.6.12 and later. This version of avr-libc contains a file named time.h. On a case insensitive operating system such as Windows this will cause

#include <Time.h>

to include the wrong file, time.h which causes the error since indeed that file doesn't declare tmElements_t. This problem is known to the author of the Time library and he has moved the code to a file named TimeLib.h as a workaround. The file Time.h was left for backwards compatibility. So the solution is to change:

#include <Time.h>

to:

#include <TimeLib.h>

I was able to get the TestRTC sketch to compile by just making this change in TestRTC.ino but you may also need to change line 25 of DS3232RTC.h.

I have submitted a pull request to fix this issue to the DS3232RTC repository: https://github.com/Tecsmith/DS3232RTC/pull/9

EDIT: My pull request has now been merged so the issue can also be solved by installing the updated Tecsmith/DS3232RTC library.

If this solves your problem please also update your other question so that the people trying to help you there will know it's fixed.

2
  • Thank you, I added a link at the other question. I will try what you suggested. Will comment again to confirm. Appreciate very helpful answer. Regret I cannot upvote it (insufficient reputation), hope other people will upvote it please. – jules Sep 27 '16 at 7:13
  • Confirming that TestRTC compiled without error after I changed Time.h to TimeLib.h for two includes as recommended above. This answer helped me to understand what was wrong (actually a difficult issue with same-name components). – jules Sep 27 '16 at 23:29
0

Consider the Arduino paradigm as a collection of well established (very) sophisticated computing tools. Arguably, the C compiler is the most complex of these tools. So understanding the compilers output can be challenging at times.

That said, the normal way to approach compiler problems is to solve the 1st error the compiler finds then recompile. More often then not solving the 1st error will resolve many other errors.

A guess, in this particular case, is that an include file has been omitted. Find where the type "tmElements_t" is defined and check to see if the include file (a.k.a. header file) where it is defined needs to be included into the source code file where the 1st errors shows up.

Added later...

Ug, the 1st error is not even your code! It is in the DS323RTC library you downloaded. We can probably assume this library is working and compiles. So that leaves the burden on us to find the reason why your code does not compile. Besides, you can't go back to GitHub saying there is a bug in the library with out trying to solve the problem first.

The 1st stop is to read any readme.txt file at GitHub or the copy of it you downloaded with the library. We find in the 1st few dozen lines this:

To use the DS3232RTC library, the Time and Wire libraries must also be included. For brevity, these includes are not repeated in the examples below:

#include <DS3232RTC.h>    //http://github.com/JChristensen/DS3232RTC
#include <Time.h>         //http://www.arduino.cc/playground/Code/Time
#include <Wire.h>         //http://arduino.cc/en/Reference/Wire (included with Arduino IDE)

So right away we see we need to include Time.h. If you look in the Time library (another library you need to download if you have not already) you will find that it is where tmElements_t is defined. It does bother me that Time.h is included after DS323RTC.h. If you are still having problems try including Time.h first.

4
  • Understand this forum deals with sketch programming. To use a sketch we must compile and we must understand compiler errors in order to fix them. Can you recommend a forum more suited for asking about Arduino compiler errors please? – jules Sep 27 '16 at 7:17
  • You are right. Stackexchange is the place to ask software questions. But as soon as they see you are asking about sketches they will likely move you back here. I'll change my answer later when I get more time. More importantly, did you figure out the problem? Was the answer correct? – st2000 Sep 27 '16 at 14:02
  • @per1234 figured out the problem. Please see accepted answer that explains the issue and provides information to fix the compile errors. – jules Sep 29 '16 at 8:40
  • Meant to say Stackoverflow.com for software questions, which is connected to the *.stackexchange.com family of forum. Sorry about the confusion. Then my comment above starts to make sense. – st2000 Oct 1 '16 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.