问题描述
我试图写一个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?
推荐答案
在这里http://www.arduino.cc/en/Hacking/BuildProcess声明:
包含路径包括了素描的
目录,目标目录
(/硬件/核心//)和
AVR的include目录
(/硬件/工具/ AVR / AVR /有/),
以及任何图书馆目录(以
/硬件/库/),这
包含一个标题文件,它是
由主草图文件中包含。
这意味着,如果的#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另一个库的库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!