Local versus installed libraries

Why does the IDE override the #include directives and load the latest versions from the core libraries instead of following C convention and loading the local libraries in the project folder when you force the #include with "" instead of <>?
Even if you put the full path in the include it still prefers the Arduino libraries over the local ones.
How do you force the IDE to only use the local set of libraries?
I dont want to rename the Arduino core libraries as they are used in other projects however for readability and portability I wish to maintain the same library names for the adapted versions.

Why do you need to modify arduino core libraries?

Because I want a very specific behaviour that is different than that provided

So write your library with specific name.

Could you provide an example of " specific behaviour"?

I'm sorry I thought that the idea of a forum was to provide help and discuss issues.

I thought this was a simple question and looking through some of the other questions regarding libraries it seems there is common confusion over the <> vs "" in the #include statements.

It appears that there is basically no difference in the compile process if you include wit "" vs <> unless there is something seriously wrong with my setup. Am I correct or is there some hidden behaviour in terms of includes that I am unaware of?

Most of system libraries contains a whole chain of included .h files. When you include the "library_name.h' in your sketch, you call only first from it. But all others still called from system libraries, so effectively you still use library from system core.

The only way to solve this - remove the corresponding system library while you using the custom one.

Or write your own library with different set of .h files

1 Like

OK thank you for that.
So provided that all local references in #includes are also locally defined using "" rather than <> and the relevant includes and source are present in the root project directory then the compiler will not try to substitute core versions or try to link with the main arduino core files?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.