I have searched and I have received the same answer but I believe mine is different I have Xcode (4.3.2) installed on my mac and when I try to compile my .cpp file it says "command not found" Any suggestions?
How I try to compile;
g++ -o program code.cpp
You need to install the "Command-Line Tools" package through the XCode "Downloads" preferences tab.
open Xcode >> Preferences... >> Downloads and download command line tools
I use
make code
and it finds a compiler, compiles code.cpp and leaves the output in code. And it tells me the name of the compiler... (it is g++).
If you type "which g++" do you find an old alias?
Do you have /usr/bin in your path?
If you do, and /usr/bin/g++ isn't found, check that you've downloaded not only Xcode but the command line utilities that are now a separate download on the developer page.