arduino_keyboardlib icon indicating copy to clipboard operation
arduino_keyboardlib copied to clipboard

Keyboard.h file found

Open magarto opened this issue 6 years ago • 1 comments

Hi,

I cannot use your library, Arduino finds standard Keyboard.h and use it. Is there any way to force Arduino to use your library?

/home/user/Documents/ducky_interpreter-master/ducky_interpreter/ducky_interpreter.ino: In function 'int process_commad(char*)':
ducky_interpreter:349: error: 'KEY_PRINTSCREEN' was not declared in this scope
      sendkey(KEY_PRINTSCREEN,0);
Multiple files found for "Keyboard.h"
Usado: /home/user/Downloads/arduino-1.8.5/libraries/Keyboard
 No usado: /home/user/Arduino/libraries/arduino_keyboardlib-master
              ^
ducky_interpreter:354: error: 'KEY_MENU' was not declared in this scope
     sendkey(KEY_MENU,0);
             ^
exit status 1
'KEY_PRINTSCREEN' was not declared in this scope

Thanks

magarto avatar Aug 01 '18 17:08 magarto

When two libraries are found that contain a file matching the #include directive, the Arduino IDE gives preference to the one with a folder name matching the file name. So for #include <Keyboard.h> /home/user/Downloads/arduino-1.8.5/libraries/Keyboard is used over /home/user/Arduino/libraries/arduino_keyboardlib-master. I can see a couple solutions:

  1. Rename the file Keyboard.h to something unique.
  2. Add a dummy .h file (use_arduino_keyboardlib.h for example). As long as the #include directive for that file comes before the one for Keyboard.h, this library's Keyword.h will now be used:
#include <use_arduino_keyboardlib.h>
#include <Keyboard.h>
  1. As an enhancement on the previous, rewrite the library so the user can set the language by simply #includeing the appropriate header file before Keyboard.h instead of having to edit the library:
#include <it_it.h>
#include <Keyboard.h>

per1234 avatar Aug 02 '18 13:08 per1234