How to use custom lib instead of system one?

Hi,
please excuse my dumb question, but i recently need an SPI lib for an Attiny85 and found one here GitHub - JChristensen/tinySPI: Arduino hardware SPI library for ATtiny44/84, 45/85, 461/861, 2313/4313.

I put it into My Documents/Arduino/libraries and use is this way in my project: #include <tinySPI.h> which seems to work.

But then i wanted to use it in combination with another lib, which depends on SPI communication and uses #include <SPI.h> many times inside his own .h and .cpp files. It throws dozends of errors while compiling, claiming that there is already an exported symbol called SPI.

I hope there is a way to use some kind of preferred lib loading or to keep own versions just inside the project folder to be update safe.

mikrotron:
But then i wanted to use it in combination with another lib, which depends on SPI communication and uses #include <SPI.h> many times inside his own .h and .cpp files. It throws dozends of errors while compiling, claiming that there is already an exported symbol called SPI.

In the lib that is using SPI, in the header file you got to change every declaration of #include <SPI.h> to #include “tinySPI”.

Don’t modify the original lib though.

Or install my ATTinyCore instead of whichever one you're using, and don't modify the library at all - my core contains a "Universal SPI" library (named SPI.h, so no changes to libraries or code are needed) that automatically selects the correct implementation of SPI for the chip you're using. Same thing for Wire/I2C.

I developed this specifically to address the problem you're encountering - that alternate implementations of Wire/SPI require modifications to the libraries that use them, and proliferate closely related but not identical copies of libraries for different hardware.

For board manager install, you can use the link in my sig. See the documentation in the github repo linked above for more details.

Don't modify the original lib though.

Well, doing so means to modify the other „original“ lib for CAN. I will give DrAzzys board a try, it sounds like what i am looking for!