The library is in the right folder but it does not work

This problem can appear when first installing a library, even if you have placed it into the correct location with the right names, you may have made the simple mistake of not restarting the IDE. As a side effect of the way your sketch is compiled, libraries are scanned during startup rather than on demand; this can cause the IDE to ignore a perfecly valid library.

On the other hand, your library may not be setup correctly, visit this FAQ [soon] for detailed installation information.

As a real world example, the code below was questioned on the Arduino forums. 

#include <Time.h>
#include <TimeAlarms.h> 

void setup(){}

void loop(){
  Alarm.timerRepeat( 100, funcPtr );

After installing the Time and TimeAlarm libraries, the code failed to compile. The IDE spits out the first error giving error: 'Alarm' was not declared in this scope. It wasn't until the IDE was restarted that the error changed to error: 'funcPtr' was not declared in this scope.


The error message given is explained in more detail here: My custom library won't work, It says: X was not declared in this scope.

Tags: compile, library
Last update:
2014-03-02 01:49
Christopher Andrews
Average rating:0 (0 Votes)

You can comment this FAQ

Chuck Norris has counted to infinity. Twice.