Is it possible to include a library from another library using the Arduino IDE?

前端 未结 5 852
栀梦
栀梦 2020-12-17 10:06

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 directo

5条回答
  •  醉梦人生
    2020-12-17 11:09

    The documentation here https://github.com/arduino/Arduino/wiki/Build-Process states:

    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.

    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.

提交回复
热议问题