板伴 / 缺少头文件 / DFRobot_DF1201S.h

DFRobot_DF1201S.h: No such file or directory

编译时找不到 DFRobot_DF1201S.h,说明还没有安装提供它的库:DFRobot_DF1201S(作者 dfrobot)。

完整报错通常长这样
fatal error: DFRobot_DF1201S.h: No such file or directorycompilation terminated.

Arduino IDE 里安装

  1. 菜单「工具 → 管理库」,或按 Ctrl+Shift+I。
  2. 搜索框输入 DFRobot_DF1201S。
  3. 在结果里找作者为 dfrobot 的那一个,点「安装」。如果弹窗问是否一起安装依赖库,选「全部安装」。
  4. 重新编译。

PlatformIO 里安装

在 platformio.ini 对应的环境下加一行,保存后重新编译,会自动下载:

lib_deps = dfrobot/DFRobot_DF1201S@^1.0.3

命令行(Arduino CLI)

arduino-cli lib install "DFRobot_DF1201S"

关于这个库

This module is a conversion board, which can drive DF1201S DFPlayer PRO MP3 through I2C. DFRobot_DF1201S is the standard library of DFRobot.

最新版本:1.0.3 · 支持:所有平台 · 许可证:MIT

源码:github.com/DFRobot/DFRobot_DF1201S · PlatformIO 页面

装了还是报错?

把完整编译报错贴进板伴,自动找出缺哪些库一次识别报错里的所有缺失头文件,按你的开发板给出能用的库和安装方法。免费、不用注册,日志只在你的浏览器里分析。

dfrobot 的其他常用库

板伴 Boardly · 给硬件初学者的免费排错工具。内容依据公开资料整理,尚未逐条经过实物验证,请以实际测量为准。