View Full Version : Bugfix: Compilation fails using Keyboard.press(...)

03-02-2013, 08:02 PM
Hi there,

I just received my first teensy and sofar im quite impressed how fast and easy one can do stuff, really cool :)
After the first blinking LEDs and pushing buttons, I'm trying to use it as a USB keyboard.
Using Keyboard.press(...) produces the following error while compiling:

usb_keyboard.c.o: In function `usb_keyboard_press_keycode':
C:\arduino-1.0.3\hardware\teensy\cores\teensy3/usb_keyboard.c:240: undefined reference to `send_now'
collect2.exe: error: ld returned 1 exit status

The c-function usb_keyboard_press_keycode(...), which is invoked by usb_keyboard_class::press(...), tries to use send_now(), which is part of the class.
Being in the wrong scope, this produces an the error above. Simply exchanging send_now() with the c-function usb_keyboard_send(), which is called by send_now() anyway, solves the problem.
As other people seem to be able to use it out of the box without an error, this is maybe some platform specific thing. Mine is Win7 x64 with a Teensy 3.0 using Arduino 1.0.3 and the latest Teensyduino 1.12.


03-02-2013, 08:17 PM
okay as I'm continuing my journey through keyboard land, I got the next bug:
Keyboard.releaseAll() produces a similar error. This time it is not defined at all.
I added this in usb_keyboard.h:

void releaseAll(void) { usb_keyboard_release_all(); }