Function was not declared in scope

Use Ctrl + T to auto-format the source code. The mistake should be apparent. (Hint: there is no such thing as a nested function in C++)