The problem you are reporting seems to me caused by the following:
- you are trying to compile C code and the source file has .cpp extension
- you are trying to compile C++ code and the source file has .c extension
In such situation Eclipse cannot recognize the proper compiler to use.