Clean the project and then rebuild it.
A little bit longer:
If you create a project with a .c file and you build it, its object file is created depending on the .c file. If you rename the .c file to .cpp the dependency between the source and object file breaks and your error gets raised.
This seems to be a makefile problem since there shouldn't be a persisting dependency between source and object file after the build process.