I cloned https://github.com/sparkfun/APDS-9960_RGB_and_Gesture_Sensor
and copied the libraries into the Arduino libraries
folder. I then launched Arduino and selected the example. I opened the file GestureTest and when I started upload I received this error:
GestureTest.ino:49:31: fatal error: SparkFun_APDS9960.h: No such file or directory
compilation terminated.
I checked the SparkFun_APDS9960.h
and I found it in the Gesture_Sensor/Libraries/src
folder.
Is there a solution to resolve this error?
1 Answer 1
SparkFun made a poor choice for the folder structure of that repository. Likely this has caused you to incorrectly install the library. Please follow these instructions:
- Download the latest release from https://github.com/sparkfun/APDS-9960_RGB_and_Gesture_Sensor/releases. Currently it is https://github.com/sparkfun/APDS-9960_RGB_and_Gesture_Sensor/archive/V_H1.0_L1.4.2.zip.
- Unzip the downloaded file.
- Rename the folder
APDS-9960_RGB_and_Gesture_Sensor-V_H1.0_L1.4.2/Libraries/Arduino
toSparkFun_APDS9960
. This is not absolutely necessary but "Arduino" is not a very descriptive name for a library folder and the Arduino IDE works best when the library folder name matches the primary header file name so this is best practices. - Copy the
SparkFun_APDS9960
folder to{sketchbook folder}/libraries
. You can find the location of the sketchbook folder at File> Preferences> Sketchbook location. - Restart the Arduino IDE if it's running (not necessary with recent versions of the Arduino IDE).
Note that the folder structure of this library requires Arduino 1.6.x or newer.
UPDATE: I submitted a pull request to put the library in an appropriately named folder. This won't change the instructions above until the next release but it does remove the need to rename the folder if you are cloning the repository or downloading from the tip of the repository rather than a release.