c++ - mbed:使用 USBDevice 库编译导致错误

标签 c++ stm32 hid mbed nucleo

我一直在尝试为我的 STM32 Nucleo F303K8 编译 USB 键盘的简单示例(我一直在关注 https://os.mbed.com/handbook/USBKeyboardhttps://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 中正常编译。

有谁知道为什么会这样?我需要导入其他东西吗?

最佳答案

您遇到此错误是因为 USBDevice 库不支持 NUCLEO_F303K8 目标。对于 Mbed 2,您可以看到没有可用于 F303K8 的文件夹 in this directory here ,对于 Mbed OS 5,您可以看到根据 USBHAL_STM32.h 不支持 F303K8 目标。文件。

关于c++ - mbed:使用 USBDevice 库编译导致错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52828259/

相关文章:

c++ - 可以使用 vector.back() 为 vector 的最后一个元素赋值吗?

stm32 - 让 stm32 ADC DMA 工作缺少什么?转会竞争不会发生

c - 读取 STM Discovery 板上的输入 GPIO

STM32F745 - HAL_FLASH_Program 不永久写入闪存

hid - HID 设备的 INF 文件 - 设置名称和图标

c++ - std::string 的 type_traits 段错误

c++ - Doxygen 提示递归 C++ 类

c++ - 函数模板 : default type parameter

c# - 阻止来自键盘 HID 的输入

arduino - Digispark 读取大写锁定状态