yyerror was not declared in this scope code example
Example 1: error: 'endl' was not declared in this scope
using namespace std;
Explanation:
mention "using namespace std;" above the main function in C++ will solve the 'endl' error
Example 2: system was not declared in this scope
#include <cstdlib>