是否可以使用 Arduino IDE 从另一个库中包含一个库?
我正在尝试编写一个 Arduino 库(实际上是一个 C++ 类),它本身引用了我在 Mac 的 ~/Documents/Arduino/libraries 目录中安装的另一个库.
I'm trying to write an Arduino library (effectively a C++ class) which itself references another library I have installed in my Mac's ~/Documents/Arduino/libraries directory.
在我正在编写的库的 .cpp 顶部,我已经尝试过
At the top of the .cpp of the library I'm writing, I've tried
#include <ReferencedLibrary.h>
和
#include "ReferencedLibrary.h"
... 两者都不起作用.我可以从 ~/Documents/Arduino 目录中的草图成功#include
.我是否遗漏了什么或者这是 Arduino IDE/makefile 的限制?有解决方法吗?
... neither of which work. I can successfully #include <ReferencedLibrary.h>
from sketches in my ~/Documents/Arduino directory. Am I missing something or is this a limitation of the Arduino IDE/makefile? Is there a workaround?
此问题已在 Arduino 1.6.6 版本中解决.1.6.6 的发行说明提到库到库的依赖关系已经修复.
This issue was solved in the Arduino 1.6.6 release. The release notes of 1.6.6 mention that library to library dependencies have been fixed.
库到库的依赖关系:当您的草图导入一个库,而该库使用另一个库时,IDE 会发现您无需向草图添加无用的#include
Library to library dependencies: when your sketch imports a library, and that library uses another, the IDE will find out without you having to add a useless #include to your sketch
将您的版本更新到 1.6.6 或更高版本将解决您的问题.
Updating your version to 1.6.6 or newer will resolve your problem.