Include library in user hardware folder.

Hey guys,

I have a user-defined board, that has a particular pinout, therefore, I had to modify some libraries for them to work correctly with this hardware.

I included those modified libraries within the hardware folder I created, but the IDE is compiling the code against another version of the library i have under /sketchbook/libraries and not the custom lib under /hardware/avr/libraries:

USED: .../sketchbook/libraries/modifiedlib_1.0
NOT USED: .../sketchbook/hardware/board/avr/libraries/modifiedlib_2.0

Is there a way to force it to compile against the "closest lib" path-wise to the core I'm using?

Thank you all in advance.

Usually, the two forms for #includes are:

#include <myLib.h>
#include "yourLib.h"

The first version searches the standard include path first for any referenced library while the second looks first in the current working directory. It will still search the standard library path, but only if it does not find the file in the current working directory. Have you used the second form with your project?

econjack:
Usually, the two forms for #includes are:

#include <myLib.h>

#include “yourLib.h”




The first version searches the standard include path first for any referenced library while the second looks first in the current working directory. It will still search the standard library path, but only if it does not find the file in the current working directory. Have you used the second form with your project?

Yep!, the thing is this modified library is useful to the core, not jus this particular piece of code. Having to copy the library for each project in which I use this core seems kinda extreme!

Thanks!

Yep!, the thing is this modified library is useful to the core, not jus this particular piece of code. Having to copy the library for each project in which I use this core seems kinda extreme!

Sounds like you may have to split the code.

econjack:
Sounds like you may have to split the code.

How so? I don't think I understand what you mean.

Well, you said that part of the library is useful to the core and you wanted to keep it there. One the other hand, it appears that some parts of the library are unique to this particular project. If that’s the case, put the core part of the code on the default path and place the unique parts in your current working directory and adjust the code accordingly. Personally, I think this is an incredibly messy way to do things, but if all else fails…

Maybe you can find some information or a starting point here: