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

Thread: Accessing from a .cpp file

  1. #1

    Accessing from a .cpp file

    This is more an Arduino IDE question than a Teensy question, but I'm hoping you guys know the answer. I'm trying to split my project up so it's more manageable, so I've set it up similarly to this:

    If I call from main.ino it's fine, but if I call it from some-class.cpp I get:

    error: 'Keyboard' was not declared in this scope
    To make a USB Keyboard, use the Tools > USB Type menu;
    This is a Teensy 3.6 and the USB Type is set as "Serial + Keyboard + Mouse + Joystick". Is there something I need to #include to get Keyboard to work from a .cpp file, or is there some kind of extern declaration that I need?

  2. #2
    #include <usb_keyboard.h>
    Seems to fix it.

Posting Permissions

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