I am just starting out with a Pro Mini. Learning slowly.
I have a small code for an I2C screen. Works fine on my laptop in the living room. Pretty basic text and graphics.
When I move it to my other laptop in my shed, it throws up this error:
C:\Users\Ian\Documents\Arduino\libraries\Adafruit_SSD1306/Adafruit_SSD1306.h:48:17: fatal error: SPI.h: No such file or directory #include <SPI.h>
This has to be a library issue right? But, I just cannot see any difference between the two laptops.
I have re-installed all the libraries. Code compiles on one, and not the other.
I have checked the Adafruit_SSD1306.h file and the are both configured the same for the display (128x64).
I have a side question....
Within this Adafruit_SSD1306.h text file, it calls: '#include <SPI.h>' and '#include <Adafruit_GFX.h>'.
Does this mean they are loaded when these files run (and therefore automatically included), and therefore do not need to be declared again at the beginning of my written code?
I ask this, as my fully working laptop code I wrote does not call the function '#include <SPI.h>' at all.
Which version of the Arduino IDE are you using on the shed laptop?
IanStMartin:
Does this mean they are loaded when these files run (and therefore automatically included), and therefore do not need to be declared again at the beginning of my written code?
It depends on the IDE version. Older versions required that #include directives be added to the sketch for all library dependencies. The preprocessing system was later improved so this was no longer necessary. For this reason, sketches that compile on newer IDE versions may fail with "No such file or directory" errors for #include directives in libraries when compiled on older IDE versions.
Both laptops have version 1.6.5.
I have gone through all the version numbers of libraries, the IDE etc. Can't see any differences.
Obviously something somewhere is outta wack
But oddly... I have other demo codes that compile fine on the shed laptop and they request #include <SPI.h>
So the SPI.h file must be there. Very odd.
I have also ensured that the paths are identical to all files on both laptops.
Looks like my living room laptop will be moving to the shed until further notice!
OK. Deleted all on the shed laptop and full re-install with 1.8.8. Seems to have fixed it.
No idea what happened there, some kind of corrupted install.
Even though it does not matter now - yes, SPI was listed under the Include Library Pert.
On a side note...
The shed laptop does compile now, but I do get an error that states:
warning: extra tokens at end of #endif directive [-Wendif-labels]
Sorry, I see it's a warning, not an error. Please do this:
Click on the black console window at the bottom of the Arduino IDE window
Press "Ctrl+A". This will select all the text in the window.
Press "Ctrl+C". This will copy the text to the clipboard.
Open this forum thread in your browser.
Click on the "</>" button in the "Quick Reply" toolbar. This will add code tags, that prevent any part of the warning output from being interpreted as markup by the forum software.
Press "Ctrl+V". This will paste the warning output inside the code tags.
Thanks for everyone's advice. This was a re-install of the IDE and it all appears to work.
Only thing that throws up is the 'xtra tokens at end of #endif directive' line, and I believe that is just a warning.
Program complies and runs fine
I'm still interested in seeing the full content of the "extra token" warning. The reason is that if it's in a library I'd like to try to get that fixed to prevent it from causing confusion for anyone else in the future.