Question

I am new to linux and unaware of how to change the version of g++ to 4.5 . I need to do that in order to execute c++0x programs.

Thanks.

No correct solution

OTHER TIPS

sudo apt-get install g++-4.5
g++-4.5

The answer to your question depends some on which Linux version you're running. To check that, try running lsb_release -a or cat /etc/*issue*.

Most Linux distributions let you install multiple versions of gcc or g++ in parallel; for example, if g++ 4.1.2 is the default version and g++ 4.5 is also installed, then to run 4.5, you would invoke g++-4.5 at the command line instead of g++. Similarly, you can also set up your makefiles to invoke g++ 4.5 by default by setting the CXX environment variable (for example, run export CXX=g++-4.5 or invoke Make using CXX=g++-4.5 make).

If you don't currently have g++ 4.5 installed, then for an Ubuntu machine, you can install it by running sudo apt-get install g++-4.5. This assumes that g++ 4.5 is available for your version of Ubuntu and that you have admin rights to your Ubuntu box; if you're using someone else's lab, you probably don't have admin rights.

If g++ isn't available for your version of your distro, or if you don't have admin rights, then you'll have to download gcc, compile it yourself, and install it under your home directory. The GCC web site has documentation on how to do so. Good luck!

If you're accessing Linux through a lab environment then you probably can't upgrade gcc as other answers are suggesting. You'll need to download the source, compile it, and install it in your home environment...if there's room.

Maybe its already installed under the name g++-4.5, so try to call that and see if it is found.

Otherwise, since you say you are using a cluster machine in the lab, ask your system administrator if g++ 4.5 is installed or could be installed. If that's not the case, ask which operating system the cluster is running so that you can install the correct binaries locally in your home directory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top