是否有可能包括使用Arduino的IDE另一个库的库? [英] Is it possible to include a library from another library using the Arduino IDE?

查看:170
本文介绍了是否有可能包括使用Arduino的IDE另一个库的库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图写一个Arduino库(实际上是一个C ++类),它本身引用我已经安装在我的Mac的〜/文稿另一个库/ Arduino的/库目录。

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"

两者都不工作

...。我可以成功地的#include&LT; ReferencedLibrary.h&GT; 在我的〜/文件/目录Arduino的草图。我缺少的东西,或这是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?

推荐答案

在这里<一个文档href=\"http://www.arduino.cc/en/Hacking/BuildProcess\">http://www.arduino.cc/en/Hacking/BuildProcess声明:

包含路径包括了素描的
  目录,目标目录
  (/硬件/核心//)和
  AVR的include目录
  (/硬件/工具/ AVR / AVR /有/),
  以及任何图书馆目录(以
  /硬件/库/),这
  包含一个标题文件,它是
  由主草图文件中包含。

The include path includes the sketch's directory, the target directory (/hardware/core//) and the avr include directory (/hardware/tools/avr/avr/include/), as well as any library directories (in /hardware/libraries/) which contain a header file which is included by the main sketch file.

这意味着,如果的#includeReferencedLibrary.h从主素描文件,这将导致该文件的目录即可添加到包括路径其他库中包括。一个黑客一点,但它确实在我的Mac工作。

This means that if you #include "ReferencedLibrary.h" from your main sketch file, this causes that file's libraries directory to get added to the include path for other libraries to include. A bit of a hack but it does work on my Mac.

这篇关于是否有可能包括使用Arduino的IDE另一个库的库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆