g++ compiler for terminal mac

Before, I was able to compile on my terminal via g++. I tried installing a new compiler such as mp-gcc47. Now when I try to compile, it gives me errors such as

fatal error: ctype: No such file or directory compilation terminated.

How do I revert to the compilers that came with OSX

I have Xcode also installed. I'm not sure if that has to do with anything.
How did you install the new compiler? You really should have used a package manager; fink or macports (not brew)
You can see which compiler is being called with:

which g++

Assuming g++ is a soft link to mp-gcc47. The default compiler from OSX is in /usr/bin. If you are getting something like /opt/local/bin/g++ you have two options: if using macports enter: sudo port select gcc none to deactivate mp-gcc47 (or the fink equivalent if you installed gcc 4.7 with fink). The second option is, if you are using macports, fink, or a custom install, make sure /usr/bin is listed in the PATH environment variable before whatever folder mp-gcc47 is in, e.g. PATH=/usr/bin:$PATH . That way the g++ in /usr/bin will be found before g++ in whatever folder mp-gcc47 (again g++ is soft link to this). If your issue is when compiling another program set the environment variable CXX=/usr/bin/g++

I use linux but whenever i walk into an apple store i can easily install g++ and use it as a c++ compiler without problems.

did u use : sudo apt-get install g++ to get it?
Install the Xcode command line tools too. If you have latest Xcode then g++ will have links to clang++
Topic archived. No new replies allowed.