function not declared in scope

Good question. It would be interesting to see the .cpp file that the IDE produced (in the applet directory).