Changing default Library

G'Day, I have three versions of the library Keypad_I2C.h. Is there a simple way of telling the compiler which one to use without editing the sketch file.

Hi ozgrant2,

Not that I am aware of.....

But it only takes a second to go to the library's header file (.h) and rename it.

Thanks,

Zeb

With platformio you can

Renaming the header file will work, but you will also often need to update all the #include directives that reference that file name.

A less intrusive solution is to add a dummy header file with a unique name to the library. You can add

#include "Keypad_I2C.h"

to the file and use the dummy header file name in the #include directives in your sketch, or you can leave the dummy file empty and add an #include directive for the dummy file above the #include directive for Keypad_I2C.h:

#include <Keypad_I2C_foo.h>
#include <Keypad_I2C.h>

The first #include directive causes the intended library to be added to the include search path, which causes the second #include directive to get the file you intended.

In some cases, you’ll be lucky enough that the stock library already contains a uniquely named header file, in which case it’s not necessary to add a header file.

ozgrant2: G'Day, I have three versions of the library Keypad_I2C.h. Is there a simple way of telling the compiler which one to use without editing the sketch file.

Whereabouts are these libraries with the same name located on the PC ?