In my Makefile I have
CC=g++
When I do mgrep gcc, I have several versions listed like: gnu/gcc/4.2.1 gnu/gcc/4.7.3 etc
I can do a module load to change my gcc version.
Now suppose I want to use multiple versions simultaneously in different makefiles, how do I do it?
The module system is basically just setting up a path to the requested module. If you want a particular compiler in a particular makefile, then you can do three things:
gcc -v|grep ${GCC_VERSION}to check that it's the right version.module load gnu/gcc/${GCC_VERSION}inside your makefile.CC=/somewhere/path-to-gcc-version/bin/g++instead ofCC=g++.Personally, I prefer 1 or 3. You can find out what the path is by doing
module load ...and thenwhich g++.[By the way, I would use
CXX=g++andCC=gcc- assuming you are not compiling files called*.cas C++-code]