This is a case of where the first error is not the root cause. In this case a function was not declared properly so the Arduino IDE didn't generate a prototype for it. When the compiler comes across a use of a function for which it has not seen a a declaration (or prototype/forward declaration) it will emit that error. The root problem was not properly closing the loop() function. There would be an error message for that further down in the error messages.