I had this error once and I found out the origin:
I was using a gcc compiler and my file was called CLIENT.C
despite I was doing a C program and not a C++ program.
gcc recognizes the .C
extension as C++ program and .c
extension as C program (be careful to the small c and big C).
So I renamed my file CLIENT.c
program and it worked.