Can I include a header file into a new header file that I created? I put #include <MCP23S17.h>
. I want to create a another header file.
-
> Can I include a header file into a new header file that I created? Yeah. That's what they are meant to be used.– dannyfMay 23, 2017 at 16:48
-
2Just remember to put Include guards to avoid problems... And remember to accept the most useful answer to avoid being bumped to the homepage uselessly...– frarugi87Sep 22, 2017 at 12:49
2 Answers
Why not just include both in the final program?
Happens all the time.
DHT.h needs AdaFruit_Sensor.h, for instance, so you just include both.
First AdaFruit then DHT
Yes, a header can include another header. But if you are using the Arduino IDE and the headers aren't in the same folder, then you'll also need an #include line for it in the .ino file.
-
3Wouldn't it have been easier to just try it to begin with instead of asking and waiting?– Delta_GMay 23, 2017 at 4:40
-
i want to llink MCP23S17.h file to my own created header file May 23, 2017 at 4:41
-
-
-
1Since Arduino IDE 1.6.6 it's no longer necessary to add includes to the sketch for library-library dependencies.– per1234Dec 20, 2017 at 4:40