Thanks all the help, yes, something wrong with gcc-4.2 or/and g++-4.2, after reinstall Xcode and symlink as below, problem solved.
1. sudo ln -s /usr/bin/g++ /usr/bin/g++-4.2
2. sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
XD
Post Situation:
Thanks all the help, yes, something wrong with gcc-4.2 or/and g++-4.2, after reinstall Xcode and symlink as below, problem solved.
1. sudo ln -s /usr/bin/g++ /usr/bin/g++-4.2
2. sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
XD
This one doesn't reproduce on developer hardware (or we wouldn't have left it in) - a person who works with this code suggests "On my mac (10.7.5), I've got gcc 4.2 and clang 3.1, can they try it with either of these compilers?"
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.