hi,
the topic "header file not found" is a frequent problem and now I have a new one:
I'd like to run my new display, a MIO283QT - 9 v2, with example code from github.
In the library directory I additionally installed the following libraries:
C:\ZusProgs\arduino-1.6.5-r5\libraries
digitalWriteFast
DisplaySPI
DS1307
GraphicsLib
MIO283QT9
Perhaps not all of them are necessary but some more should be better than some missing.
In my working directory with sketches I have the example code from github:
...\examples\Display_SPI\Display_SPI.ino
Compiling the code results in an error in the library code:
C:\ZusProgs\arduino-1.6.5-r5\libraries\DisplaySPI\DisplaySPI.cpp:19:25: fatal error: GraphicsLib.h: No such file or directory #include "GraphicsLib.h"
^
compilation terminated.
Error compiling.
The content of DisplaySPI.cpp is:
...
#include "SPI.h"
#include "Wire.h"
#include <digitalWriteFast.h>
#include "GraphicsLib.h" <--- in this line 19 the compiler cannot find the header file
#include "DisplaySPI.h"
#include "cmd.h"
...
In a first test I used the original code and got the same error at line 18 , i.e. digitalWriteFast.h could not be found. The code was:
...
#include "SPI.h"
#include "Wire.h"
#include "digitalWriteFast.h" <--- in this line 18 the compiler cannot find the header file
#include "GraphicsLib.h"
#include "DisplaySPI.h"
#include "cmd.h"
...
For the header digitalWriteFast.h changing from " " to < > helped but not for GraphicsLib.h.
The file GraphicsLib.h really is contained in the ...\libraries\GraphicsLib directory.
In the Arduino IDE 1.6.5 I can see that the library GraphicsLib is availble (with menue Sketch / Include Library).
Now I have shifted the extra libraries to the right place - hopefully.
My preferences define the Sketchbook location as "H:\Arduino\examples".
In this directory there is a subdirectory libraries: H:\Arduino\examples\libraries.
The additional libraries
digitalWriteFast
DisplaySPI
DS1307
GraphicsLib
MIO283QT9
now are located there, i.e. in H:\Arduino\examples\libraries.
I used the original code in DisplaySPI.cpp (line 18 with " " instead of < >):
...
#include "SPI.h"
#include "Wire.h"
#include "digitalWriteFast.h" <--- in this line 18 the header file is found
#include "GraphicsLib.h" <--- in this line 19 the compiler cannot find the header file
#include "DisplaySPI.h"
#include "cmd.h"
...
.. and get the same compile error:
H:\Arduino\examples\libraries\DisplaySPI\DisplaySPI.cpp:19:25: fatal error: GraphicsLib.h: No such file or directory #include "GraphicsLib.h"
^
compilation terminated.
Error compiling.
I cannot understand why the file "digitalWriteFast.h" in line 18 is found but "GraphicsLib.h" is not found.
Both libraries are in the same location.
<> is used for library files, "" for files in the current directory (local .h files). In practice I think
both places are searched, but in a different order. The IDE may however enforce that constraint
so always use <> from a sketch for library files. Case matters.
I am having a similar problem. I created a "User Library" directory in the Arduino sketch directory. That is Arduino/libraries/xxx where xxx is the name of a library file.
There are about 9 of these libraries (three were "updates"). The ino file is in a directory under the Arduino directory, say Arduino/Test/Test.ino.
The Test.ino file includes one or more of the library in the "User Library". If I use the Arduino IDE everything compiles. If I use Visual Studio (any version) with the Arduino plugin the compilation fails to find some of the library files. In particular if one of the library files includes another library file it cannot be found.
The only way I have been able to compile this program that compiles without difficulty with the Arduino IDE is to include all of the libraries in the Test.ino file (even those that are never referenced directly in the Test.ino file). None of my other experiments have yielded a successful compilation.
What is wrong with the plugin that it requires including the "User Libraries" in the ino file?
What is wrong with the plugin that it requires including the "User Libraries" in the ino file?
I have no idea what plugin you are talking about, but the IDE does not allow a library to hide that fact that it uses another library.
If library a uses library b which uses library c, and the example sketches do not include a.h, b.h, and c.h, then it can be a nightmare trying to find and download all libraries needed to use a. The IDE needs to be restarted after each new library is added. I'd be ready to have words with the developer of the a library if I had to hunt up library b, install it, restart the IDE, and then discover that I still couldn't compile and link the mess that was library a.