The error messages indicate that the error is from compiling a C file as a C++ file. My best guess is that there’s something off with your compiler installation. gcc should autodetermine the file type, but if it was symlinked or otherwise linked to g++, that might not work appropriately.
What do the following commands print?
which gcc-4.2
which g++-4.2
If you could do an “ls -l” on both of the output paths, that would be helpful too.