Sterling
Sterling
DIIDevHeads IoT Integration Server
Created by Sterling on 9/3/2024 in #firmware-and-baremetal
Compilation Error with USB Keyboard Example on STM32 Nucleo F303K8 in Mbed
I've been trying to compile a simple USB Keyboard example for my STM32 Nucleo F303K8, following the guides from Mbed and Hackerspace NTNU. My main.cpp file is as follows:
#include "mbed.h"
#include "USBKeyboard.h"

USBKeyboard keyboard;

int main(void) {

while (1) {
wait(1);
keyboard.printf("Test");
}
}
#include "mbed.h"
#include "USBKeyboard.h"

USBKeyboard keyboard;

int main(void) {

while (1) {
wait(1);
keyboard.printf("Test");
}
}
However, when I try to compile, I encounter this error:
Error: Identifier "PCD_HandleTypeDef" is undefined in "USBDevice/USBDevice/USBHAL.h", Line: 134, Col: 6
Error: Identifier "PCD_HandleTypeDef" is undefined in "USBDevice/USBDevice/USBHAL.h", Line: 134, Col: 6
The error presents itself in both the Mbed Online Compiler and locally using the PlatformIO plugin for VSCode. Surprisingly, excluding the USBDevice library from Mbed allows successful compilation of code in both IDEs. Is there any information about why this occurrence is happening? Is it necessary for me to incorporate another library or dependency?
4 replies