Last modified: Sep 16, 2009 by Bouvet
SOFT: C and C++ programming at CC
1. C compilers
The users at CC may use the different C compilers.
1.1. gcc compiler (GNU)
The is the default C compiler for Linux, developped by
GNU. the command for compiling is
gcc (or
cc). To know the version of the compiler type:
> gcc -v
> cc -v
The doc is available using the command:
> man gcc
1.2. pgcc compiler (Portland Group)
The CC has some number of floating licenses (via FlexLM) for the C compiler supplied by the
PGI (Portland Group). In order to compile your code with this compiler you should initialise the variables by the command
pgi_env (pgi_env32 in 32-bit compatibility mode). To know the compiler options:
> pgi_env
> man pgcc
The complete doc is available,
cliquez here.
Example:
> pgi_env
> pgcc -O -c test.
For linking your program with the (
CERNLIB), you should add the library
libg2c.a which is a part of
g77 compiler. The same remark is valid for other libraries compiled with
g77 (like the
NAG library).
> pgi_env
> set g2c = '-lg2c'
> pgcc -O -o test test.c `cernlib` -lpthread -lm ${g2c}
> ./test
1.3. icc compiler (INTEL)
The CC has some number of floating licenses (via FlexLM) for the C compiler supplied by
INTEL. In order to compile one should initialise the variables using the command
icc_env. To know the compiler options, type:
> icc_env
> man icc
The doc is available,
cliquez here.
Example:
> icc_env
> icc -O -c test.c
For linking your program with the (
CERNLIB), you should add the library
libg2c.a which is a part of
g77 compiler. The same remark is valid for other libraries compiled with
g77 (like the
NAG library).
> icc_env
> set g2c = '-lg2c'
> icc -O -o test test.c `cernlib` -lpthread -lm ${g2c}
> ./test
You can use the debugger and the profiler with the names:
pgdbg and
pgprof.
2. C++ compilers
The users at CC may use the different C++ compilers.
2.1. g++ compile (GNU)
The is the default C++ compiler for Linux, developped by
GNU. the command for compiling is
g++ (or
c++). To know the version of the compiler type:
> g++ -v
> c++ -v
The doc is available via the command:
> man g++
2.2. pgCC compiler (Portland Group)
The CC has some number of floating licenses (via FlexLM) for the C++ compiler supplied by the
PGI (Portland Group). In order to compile your code with this compiler you should initialise the variables by the command
pgi_env. To know the compiler options:
> pgi_env
> man pgCC
The doc is available,
cliquez here.
2.3. icc compiler (INTEL)
The CC has some number of floating licenses (via FlexLM) for the C++ compiler supplied by
INTEL. In order to compile one should initialise the variables using the command
icc_env. To know the compiler options, type:
> icc_env
> man icc
The doc is available,
cliquez here.