gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 04:31:15 25 4
gpt4 key购买 nike

我一直在尝试为我的 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com