我一直在尝试为我的 STM32 Nucleo F303K8 编译一个简单的 USB 键盘示例(我一直在关注https://os.mbed.com/handbook/USBKeyboard和https://www.hackerspace- ntnu.no/wiki/tutorials/mbed/mbed-keyboard-en/)
基本上我的全部main.cpp
是:
#include "mbed.h"
#include "USBKeyboard.h"
USBKeyboard keyboard;
int main(void) {
while (1) {
wait(1);
keyboard.printf("Test");
}
}
但是在编译时,我被告知
Error: Identifier "PCD_HandleTypeDef" is undefined in "USBDevice/USBDevice/USBHAL.h", Line: 134, Col: 6
该特定错误是从我在https://os.mbed.com/compiler上的项目中复制的——我还尝试从 VSCode 中的本地项目构建(使用 PlatformIO 插件),但我遇到了同样的问题。如果没有 mbed 的 USBDevice 库,我可以从两个 IDE 中正常编译。
有谁知道为什么会发生这种情况?我需要导入其他东西吗?