C++ compilers at IDA
There are several C++ compilers available at IDA. On the Sun computer system, where most C++ courses are given, we have the Sun C++ compiler (run with the command CC), and the GNU GCC C++ compiler (run with command g++). At present the GCC compiler is best conforming with the new C++ standard (C++11).
Changing GCC version on IDA's Sun computer system
For best conformance with the current C++ standard, you may have to change to a newer version of GCC, than the default version. Another reason can be that you want to use features from the comming new C++ standard (C++11). Which modules are available for gcc, you can check with the following command:
module avail prog/gcc
You will get a list with version numbers printed, which are also module file names. With the following command you can check if you have the gcc module loaded (which normally is the case), and which version:
You will get a list with all modules you have loaded. If you allready have the default version added to your environment, you can change version in a terminal window (to 4.6.3 as example) by first removing the current version, and then adding the version of your choise:module list
module rm prog/gcc module add prog/gcc/4.6.3
This will only affect the terminal window in question. Normally one
wish to affect the whole environment, and also have this performed
automatically. In such case, edit the start-up file .login as
follows. Since the GCC module is normally loaded by the module
'default' (which should be loaded first of all modules) you have to
unload the default version of GCC and the load the one you want. To do
this, put the following lines in .login, after the 'module add'
command loading the 'default' module (gcc 4.6.3 as example):
module rm prog/gcc module add prog/gcc/4.6.3
This way you will have version 4.6.3 automatically loaded at login.
Please note, it does not work in this case to use the module commands
initrm and initadd in a terminal window, to
modify the .login file.
Versions from and including 4.5 has much of the new standarden implemented, both concerning the standard library and the core language. Compile using option '-std=c++0x'.
See also specific information to use GCC version 4.6!
Page responsible: Tommy Olsson
Last updated: 2012-03-23
