Code errors was not declared

Arduino: 1.8.15 (Linux), Board: "Arduino Uno"

In file included from /home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino:44:0:
/opt/arduino-1.8.15/libraries/Keyboard/src/Keyboard.h:29:2: warning: #warning "Using legacy HID core (non pluggable)" [-Wcpp]
#warning "Using legacy HID core (non pluggable)"
^~~~~~~
sketch_aug11a:48:52: error: 'USB_KeyboardReport_Data_t' was not declared in this scope
static uint8_t PrevKeyboardHIDReportBuffer[sizeof (USB_KeyboardReport_Data_t)];
^~~~~~~~~~~~~~~~~~~~~~~~~
sketch_aug11a:58:1: error: 'USB_ClassInfo_HID_Device_t' does not name a type
USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
^~~~~~~~~~~~~~~~~~~~~~~~~~
sketch_aug11a:172:42: error: 'USB_ClassInfo_HID_Device_t' was not declared in this scope
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^~~~~~~~~~~~~~~~~~~~~~~~~~
sketch_aug11a:172:70: error: expected primary-expression before 'const'
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^~~~~
sketch_aug11a:172:101: error: expected primary-expression before '' token
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t
const HIDInterfaceInfo,
^
sketch_aug11a:172:103: error: expected primary-expression before 'const'
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^
sketch_aug11a:172:119: error: expected primary-expression before 'const'
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^
sketch_aug11a:172:145: error: expected primary-expression before 'void'
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^
sketch_aug11a:172:171: error: expected primary-expression before '' token
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t
const HIDInterfaceInfo,
^
sketch_aug11a:172:173: error: expected primary-expression before 'const'
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^
/home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino:172:189: warning: expression list treated as compound expression in initializer [-fpermissive]
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^
sketch_aug11a:258:43: error: variable or field 'CALLBACK_HID_Device_ProcessHIDReport' declared void
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^~~~~~~~~~~~~~~~~~~~~~~~~~
sketch_aug11a:258:43: error: 'USB_ClassInfo_HID_Device_t' was not declared in this scope
sketch_aug11a:258:71: error: expected primary-expression before 'const'
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^~~~~
sketch_aug11a:258:95: error: expected primary-expression before 'const'
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^
sketch_aug11a:258:119: error: expected primary-expression before 'const'
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^
sketch_aug11a:258:145: error: expected primary-expression before 'const'
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^
sketch_aug11a:258:169: error: expected primary-expression before 'const'
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^
In file included from /opt/arduino-1.8.15/hardware/tools/avr/avr/include/avr/io.h:99:0,
from /opt/arduino-1.8.15/hardware/tools/avr/avr/include/avr/pgmspace.h:90,
from /opt/arduino-1.8.15/hardware/arduino/avr/cores/arduino/Arduino.h:28,
from sketch/sketch_aug11a.ino.cpp:1:
/home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino: In function 'void __vector_16()':
sketch_aug11a:79:18: error: 'PC7' was not declared in this scope
PORTC |= _BV(PC7); // Turn on the led
^
/home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino:79:18: note: suggested alternative: 'PB7'
sketch_aug11a:84:19: error: 'PC7' was not declared in this scope
PORTC &= ~_BV(PC7);
^
/home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino:84:19: note: suggested alternative: 'PB7'
/home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino: In function 'int main()':
sketch_aug11a:99:3: error: 'GlobalInterruptEnable' was not declared in this scope
GlobalInterruptEnable();
^~~~~~~~~~~~~~~~~~~~~
sketch_aug11a:103:25: error: 'Keyboard_HID_Interface' was not declared in this scope
HID_Device_USBTask(&Keyboard_HID_Interface);
^~~~~~~~~~~~~~~~~~~~~~
sketch_aug11a:103:5: error: 'HID_Device_USBTask' was not declared in this scope
HID_Device_USBTask(&Keyboard_HID_Interface);
^~~~~~~~~~~~~~~~~~
sketch_aug11a:104:5: error: 'USB_USBTask' was not declared in this scope
USB_USBTask();
^~~~~~~~~~~
/home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino: In function 'void SetupHardware()':
sketch_aug11a:113:3: error: 'wdt_disable' was not declared in this scope
wdt_disable();
^~~~~~~~~~~
sketch_aug11a:116:22: error: 'clock_div_1' was not declared in this scope
clock_prescale_set(clock_div_1);
^~~~~~~~~~~
sketch_aug11a:116:3: error: 'clock_prescale_set' was not declared in this scope
clock_prescale_set(clock_div_1);
^~~~~~~~~~~~~~~~~~
sketch_aug11a:119:3: error: 'USB_Init' was not declared in this scope
USB_Init();
^~~~~~~~
In file included from /opt/arduino-1.8.15/hardware/tools/avr/avr/include/avr/io.h:99:0,
from /opt/arduino-1.8.15/hardware/tools/avr/avr/include/avr/pgmspace.h:90,
from /opt/arduino-1.8.15/hardware/arduino/avr/cores/arduino/Arduino.h:28,
from sketch/sketch_aug11a.ino.cpp:1:
sketch_aug11a:121:15: error: 'PC7' was not declared in this scope
DDRC |= _BV(PC7); // PC7 as output
^
/home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino:121:15: note: suggested alternative: 'PB7'
/home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino: In function 'void EVENT_USB_Device_ConfigurationChanged()':
sketch_aug11a:144:51: error: 'Keyboard_HID_Interface' was not declared in this scope
ConfigSuccess &= HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface);
^~~~~~~~~~~~~~~~~~~~~~
sketch_aug11a:144:20: error: 'HID_Device_ConfigureEndpoints' was not declared in this scope
ConfigSuccess &= HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sketch_aug11a:146:3: error: 'USB_Device_EnableSOFEvents' was not declared in this scope
USB_Device_EnableSOFEvents();
^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino: In function 'void EVENT_USB_Device_ControlRequest()':
sketch_aug11a:153:37: error: 'Keyboard_HID_Interface' was not declared in this scope
HID_Device_ProcessControlRequest(&Keyboard_HID_Interface);
^~~~~~~~~~~~~~~~~~~~~~
sketch_aug11a:153:3: error: 'HID_Device_ProcessControlRequest' was not declared in this scope
HID_Device_ProcessControlRequest(&Keyboard_HID_Interface);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino:153:3: note: suggested alternative: 'EVENT_USB_Device_ControlRequest'
HID_Device_ProcessControlRequest(&Keyboard_HID_Interface);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EVENT_USB_Device_ControlRequest
/home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino: In function 'void EVENT_USB_Device_StartOfFrame()':
sketch_aug11a:159:34: error: 'Keyboard_HID_Interface' was not declared in this scope
HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);
^~~~~~~~~~~~~~~~~~~~~~
sketch_aug11a:159:3: error: 'HID_Device_MillisecondElapsed' was not declared in this scope
HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino: At global scope:
sketch_aug11a:172:42: error: redefinition of 'bool CALLBACK_HID_Device_CreateHIDReport'
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/Arduino/sketch_aug11a/sketch_aug11a.ino:172:6: note: 'bool CALLBACK_HID_Device_CreateHIDReport' previously defined here
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sketch_aug11a:172:42: error: 'USB_ClassInfo_HID_Device_t' was not declared in this scope
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^~~~~~~~~~~~~~~~~~~~~~~~~~
sketch_aug11a:172:70: error: expected primary-expression before 'const'
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^~~~~
sketch_aug11a:173:49: error: expected primary-expression before '' token
uint8_t
const ReportID,
^
sketch_aug11a:173:51: error: expected primary-expression before 'const'
uint8_t* const ReportID,
^~~~~
sketch_aug11a:174:42: error: expected primary-expression before 'const'
const uint8_t ReportType,
^~~~~
sketch_aug11a:175:42: error: expected primary-expression before 'void'
void* ReportData,
^~~~
sketch_aug11a:176:50: error: expected primary-expression before '' token
uint16_t
const ReportSize)
^
sketch_aug11a:176:52: error: expected primary-expression before 'const'
uint16_t* const ReportSize)
^~~~~
sketch_aug11a:258:43: error: variable or field 'CALLBACK_HID_Device_ProcessHIDReport' declared void
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^~~~~~~~~~~~~~~~~~~~~~~~~~
sketch_aug11a:258:43: error: 'USB_ClassInfo_HID_Device_t' was not declared in this scope
sketch_aug11a:258:71: error: expected primary-expression before 'const'
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
^~~~~
sketch_aug11a:259:43: error: expected primary-expression before 'const'
const uint8_t ReportID,
^~~~~
sketch_aug11a:260:43: error: expected primary-expression before 'const'
const uint8_t ReportType,
^~~~~
sketch_aug11a:261:43: error: expected primary-expression before 'const'
const void* ReportData,
^~~~~
sketch_aug11a:262:43: error: expected primary-expression before 'const'
const uint16_t ReportSize)
^~~~~
exit status 1
'USB_KeyboardReport_Data_t' was not declared in this scope

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

Hi @newfie98. The Arduino Uno board is not compatible with the Keyboard library. If you need keyboard emulation capabilities, you must use one of the Arduino boards that has it.

Some nice options:

1 Like

Thanks pert!!

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per