Go Down

Topic: How do you now which .h file is being included? (Read 60 times) previous topic - next topic

joshyrd

Here's my problem.

I have a sketch designed for I2C communication with the UNO and including wire.h

I want use the sketch with an adafruit controller where they have there own wire.h file in their hardware folder.

How would you guys proceed?

pert

Because it's an architecture-specific library, each hardware package bundles its own version of the Wire library. The libraries bundled with hardware packages are only accessible to the Arduino IDE when a board of that package is selected from the Tools > Board menu. So the Arduino IDE will automagically always use the correct Wire library and you don't need to worry about it at all. The only exception is if for some reason you installed your own copy of the Wire library outside of the hardware package folder. So just don't do that and everything is good.


pert

You're welcome. I'm glad if I was able to be of assistance.

And to answer the question in the title of this thread: When there are multiple libraries that contain a file matching the #include directive the Arduino IDE will display a "Multiple libraries were found" message in the console. In some cases this message will only be shown if you have verbose output during compilation enabled (File > Preferences > Show verbose output during > Compilation).

You can also see the full include search path in the verbose output. This will contain the paths to all library dependencies of the sketch as well as the other search paths like the core library, variant folder, and toolchain.

Go Up