Found an old library- unable to compile

I am working on a telephone project and my get_dial function is evolved from a sketch found on the web. It works, but is rather convoluted. But it works.

Then I found a library on github that if it worked would greatly simplify my project.

I modified the example sketch, which was a .pde file, so it's old.

Here's my test sketch:

/**
   Print each digit over Serial as it is dialed.
   See the README for detailed documentation.
*/

#include "D:\River Documents\Arduino\Projects\Telephone\Dial\Rotary-Dial-master\RotaryDialer.h"

#define PIN_READY	D6
#define PIN_PULSE	D5

RotaryDialer dialer = RotaryDialer(PIN_READY, PIN_PULSE);

void setup() {
  Serial.begin(115200);
  Serial.println();
  Serial.println(F("Ready"));
  dialer.setup();
}

void loop() {
  if (dialer.update()) {
    Serial.println(dialer.getNextNumber());
  }
}

However, when compiling, I get this error:

Error compiling for board LOLIN(WEMOS) D1 R2 & mini.
(I get the same error compiling for the Uno, but my test hardware is on a Wemos D1 Mini)

I am not proficient at writing libraries, but I don't see anything odd in the RotaryDialer.cpp file.
I suspect that I am missing an include file to define something unique to the Wemos (I.E. 8266) that I've never needed before.

I don't like fixing something that ain't broke- I have dozens of working sketches on the Wemos D1 Mini so I don't want to go into the existing libraries.

I would appreciate it if anyone has an idea for me to look at.

There should be a more specific error message than that - is there something above the error you posted?

It does not appear to be anything to do with the library.

But I did find this when I googled the compile error:

You may need to update the core for the board you are using.

boylesg:
You may need to update the core for the board you are using.

Thanks, but I am running the latest version of the board manager for the Wemos.

I have several sketches working just fine on the Wemos D1 Mini, and since this is an old library, I am looking for what is different from more recent code.

wildbill:
There should be a more specific error message than that - is there something above the error you posted?

Oh, quite a bit... Thanks for the reply.

Here's the whole error message:

Arduino: 1.8.9 (Windows 10), Board: "LOLIN(WEMOS) D1 R2 & mini, 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

c:/users/steve/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: sketch\dialtoserial.ino.cpp.o:(.text.setup+0x10): undefined reference to `RotaryDialer::setup()'

c:/users/steve/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: sketch\dialtoserial.ino.cpp.o: in function `setup':

D:\River Documents\Arduino\Projects\Telephone\Dial\Rotary-Dial-master (poll)\examples\dialtoserial/dialtoserial.ino:15: undefined reference to `RotaryDialer::setup()'

c:/users/steve/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: D:\River Documents\Arduino\Projects\Telephone\Dial\Rotary-Dial-master (poll)\examples\dialtoserial/dialtoserial.ino:17: undefined reference to `RotaryDialer::update()'

c:/users/steve/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: D:\River Documents\Arduino\Projects\Telephone\Dial\Rotary-Dial-master (poll)\examples\dialtoserial/dialtoserial.ino:17: undefined reference to `RotaryDialer::getNextNumber()'

c:/users/steve/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: sketch\dialtoserial.ino.cpp.o: in function `loop':

D:\River Documents\Arduino\Projects\Telephone\Dial\Rotary-Dial-master (poll)\examples\dialtoserial/dialtoserial.ino:20: undefined reference to `RotaryDialer::update()'

c:/users/steve/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: D:\River Documents\Arduino\Projects\Telephone\Dial\Rotary-Dial-master (poll)\examples\dialtoserial/dialtoserial.ino:21: undefined reference to `RotaryDialer::getNextNumber()'

c:/users/steve/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: D:\River Documents\Arduino\Projects\Telephone\Dial\Rotary-Dial-master (poll)\examples\dialtoserial/dialtoserial.ino:22: undefined reference to `RotaryDialer::RotaryDialer(int, int)'

c:/users/steve/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: sketch\dialtoserial.ino.cpp.o: in function `_GLOBAL__sub_I_dialer':

D:\River Documents\Arduino\Projects\Telephone\Dial\Rotary-Dial-master (poll)\examples\dialtoserial/dialtoserial.ino:11: undefined referenceRotaryDialer(int, int)'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board LOLIN(WEMOS) D1 R2 & mini.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

As I said, libraries are above my pay grade, but there are a few "undefined reference to `RotaryDialer::" errors, but I see the "missing" functions in the cpp file. Should there be prototypes for them in the .h file as well?

Go to: GitHub - markfickett/Rotary-Dial: Arduino library to receive numbers dialed by a rotary telephone dial via pulse dialing
Click on "Clone or download"
Click on "Download ZIP"

Go to the Arduino IDE.
Select Sketch->Install Library->Add .ZIP Library
Select the downloaded "Rotary-Dial-master.zip"
Select File->Examples->Rotary-Dial-master->dialtoserial
The example sketch will compile without error for an Arduino UNO.
It should not take much to get it to compile for your non-Arduino board.

You may want to rename "Rotary-Dial-master" to "RotaryDial" and change "dialtoserial.pde" to "DialToSerial.ino" for neatness.

Thanks, John.

I didn't realize that there was a difference from the IDE whether I manually installed a library or used the Library Manager. I had been installing untested libraries manually for so long that this fix never occurred to me.

BTW, thanks to your encouragement and assistance, I have completely stopped using String class. My current project is getting large- over 1,000 lines of sketch code, so memory is a premium.

I am also avoiding delay() statements as well, and I have learned to use tabs to make the functions more manageable.

Maybe I can't call myself an Arduino Novice any longer?

SteveMann:
I didn't realize that there was a difference from the IDE whether I manually installed a library or used the Library Manager.

There is absolutely no difference between a correct manual library installation and an installation via Library Manager or Add .ZIP Library. The IDE installation method is preferable because it ensures the library is correctly installed. In cases where the library (or the version of the library you want) is not in the Library Manager index and the .zip file doesn't have the right structure for Add .ZIP Library, or when you want to update a library installed via Add .ZIP Library or manually installed, it's good to understand how to do a manual installation.

Note that the installation method described by johnwasser is not Library Manager. Library Manager is at Sketch > Include Library > Manage Libraries (Or Tools > Manage Libraries also on recent versions of the Arduino IDE). However, Library Manager doesn't help in this case because the Rotary-Dial library is not in the Library Manager index and so it can't be installed or updated via Library Manager.

pert:
There is absolutely no difference between a correct manual library installation and an installation via Library Manager or Add .ZIP Library.

I thought that if you installed the library manually, by creating the library folder/directory and copying the files into it, you had to take some additional step, like re-starting the IDE, to get the examples to show up under File->Examples. That would be a difference.

You're right. That is a difference. The manually installed library won't appear under Sketch > Include Library and its example sketches won't appear under File > Examples until the Arduino IDE has scanned the libraries. Libraries are scanned whenever the Arduino IDE starts, the board is changed, Library Manager is opened or closed, and Boards Manager is opened or closed. Unlike with old IDE versions which only scanned libraries on start up, you can compile the manually installed library fine without restarting the Arduino IDE.