I've been stuck for days unable to resolve the compile error: 'Adafruit_GFX_Button' was not declared in this scope and would really appreciate ideas, suggestions, pointers to solutions or a recommended beer to relieve the stress.
This code attempting a function definition results in these error messages:
bool update_button(Adafruit_GFX_Button *b, bool down) {
error: ''Adafruit_GFX_Button' was not declared in this scope
error: 'b' was not declared in this scope
error: expected primary-expression before 'bool'
error: expression list treated as compound expression in initializer [-fpermissive]
In function 'bool update_button(Adafruit_GFX_Button*, bool)':
error: 'bool update_button(Adafruit_GFX_Button*, bool)' redeclared as different kind of symbol
bool update_button(Adafruit_GFX_Button *b, bool down) {
note: previous declaration 'bool update_button'
This code is in a tab all by itself. The second line successfully references Adafruit_GFX_Button but the third line and several other similar lines always throw errors.
#include "Adafruit_GFX.h"
Adafruit_GFX_Button circle_btn, square_btn, triangle_btn, line_btn, led_btn, RGB_btn;
bool update_button(Adafruit_GFX_Button *b, bool down) {
b->press(down && b->contains(pixel_x, pixel_y));
if (b->justReleased())
b->drawButton(false);
if (b->justPressed())
b->drawButton(true);
return down;
}
The same exact code in a simple project works great but when I add it into my main project it consistently gets these errors. It would seem something about the preprocessing may be the problem. But how to tease apart what????