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.dannyf– dannyf2017年05月23日 16:48:36 +00:00Commented May 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...frarugi87– frarugi872017年09月22日 12:49:06 +00:00Commented Sep 22, 2017 at 12:49
2 Answers 2
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_G– Delta_G2017年05月23日 04:40:07 +00:00Commented May 23, 2017 at 4:40
-
i want to llink MCP23S17.h file to my own created header fileMathusuthan Packiyarajah– Mathusuthan Packiyarajah2017年05月23日 04:41:47 +00:00Commented May 23, 2017 at 4:41
-
can you give some suggestion to itMathusuthan Packiyarajah– Mathusuthan Packiyarajah2017年05月23日 04:42:14 +00:00Commented May 23, 2017 at 4:42
-
-
1Since Arduino IDE 1.6.6 it's no longer necessary to add includes to the sketch for library-library dependencies.per1234– per12342017年12月20日 04:40:54 +00:00Commented Dec 20, 2017 at 4:40