error: 'endl' was not declared in this scope

C
using namespace std;

Explanation:
mention "using namespace std;" above the main function in C++ will solve the 'endl' error
Source

Also in C: