When I build my project (any project, really - I tried creating a new empty project with the same results), it builds fine with GCC 4.2 under either Xcode4 or Xcode 3.2.4.
It sounds to me like your installation is borked.
When you installed Xcode4 did you make sure to install it to a completely separate directory to your existing Xcode install?
It could also have something to do with your include paths or something in that vein. I'm not too sure how to go about fixing that.
I would suggest backing up any custom templates etc. and running the uninstall script for both Xcode 3.x and 4, and then reinstalling to see if that fixes the issues.