I have a project wit the following include files :
// Include Libraries :
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <SPI.h>
#include "Wire.h"
#include <phi_interfaces.h>
#include <EEPROM.h>
#include <SdFat.h>
SdFat SD; // Wrap SD members into SDFat
#include <MFRC522.h>
#include <MemoryFree.h>
The whole IDE 1.6.9 and code was ported to a new PC. And I get a compile error saying "Wire.h"does not exist. But an example sketch under Wire compiles. So to see if I have other issues I comment out Wire.h related statements.
Next is, even if I hide the LiquidCrystal folder inside another folder in the path C:\Users\RRNathan\Documents\Arduino\libraries the code still does not report any issue on missing LCD.h or LiquidCrystal_I2C.h
I am confused how this can happen ? Is there any document that lists the details on the total aspects of libraries , their location and such aspects ??
#include "Wire.h"
This form of #include implies that the library file is in the same folder as the program code. The effect of it not being there may have changed with different versions of the IDE. Where is it located on your system ?
Use "#include <Wire.h>"
The " and " are used to include a file in the same project, and the < and > are use for a library.
Incluse the Wire.h before the LiquidCrystal_I2C.h
For which Arduino board are you compiling ?
In C, the use of double quotes around a header file (".h") causes the compiler to search the current working directory for the file. In other words, it looks where your Arduino sketch is located. The angle brackets (<.h>) cause the compiler to look in the default library directory, or in the libraries directory where you installed the Arduino IDE.
That said, if you use double quotes as you did for Wire.h and it did not find it in your sketch directory, it should automatically look in your default library directory (i.e., libraries). Since this didn't happen, Bob's suggestion might lead to a resolution.
Ok the point on Wire.h is clear now. But still the issue with LiquidCrystal still baffles. Does the compiler look at any other folder for library files ??
Check the following menu sequence from the IDE:
Sketch --> Include Library --> Add Zip
Note the directory and see if the missing library is in that directory. The IDE does this so that, if you upgrade the IDE, the libraries are still present. I usually install new libraries outside of the IDE, placing them directly in the libraries subdirectory. Potato...potaato.
Ok here we have a snapshot of the libraries that the IDE is using to build.
Using library LiquidCrystal in folder: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal (legacy)
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire
Using library phi_interfaces in folder: C:\Users\RRNathan\Documents\Arduino\libraries\phi_interfaces (legacy)
Using library EEPROM at version 2.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM
Using library SdFat in folder: C:\Users\RRNathan\Documents\Arduino\libraries\SdFat (legacy)
Using library rfid-master at version 2015.9.4 in folder: C:\Users\RRNathan\Documents\Arduino\libraries\rfid-master
Using library MemoryFree-master in folder: C:\Users\RRNathan\Documents\Arduino\libraries\MemoryFree-master (legacy)
So apart from the folder I specify in Preferences it also uses the native libraries from C:\Program Files(x86)\Arduino\library and to boot there are two different locations there too !!
I have no qualms about this - let it go ahead and use it. But when I have a more advanced LiquidCrystal in preferred folder why is it choosing the Legacy version as above ?
Would it not be a good idea to have all libraries in one location under my control ? What I add will be there and what is native will also be copied ( by me ) to the same location.
Not a good idea ??
And just noticed this. The path as specified for SketchBook Location in prefernces is :
C:\Users\RRNathan\Documents\Arduino
And what the compiler uses is from :
C:\Users\RRNathan\Documents\Arduino\libraries
I see that most libraries are existing in ....\ Arduino and some of them in ... Arduino \ libraries .
Of course being a bit new to all this, I would have done this accidentally.
But which exactly is the recommended procedure ?
I think you'll find that only the libs in the 'libraries' folder will be displayed in the menu Sketch > Include Library.
If you turn on verbose mode, when you open the IDE or change boards, does it give errors about invalid sketch folders listing the libs not inside the 'libraries' folder (due to the libraries not having an .ino file)?
If so, using the correct locations may solve this.