create new tag
, view all tags

Using the GNU compilers (gcc, gfortran)

  • The gnu compilers are in /usr/bin/, and thus /usr/bin/ must be in your path to access them.
Fortan gfortran
C gcc
C++ g++

  • The current default version (as of Jan 2012) is gcc version 4.1.2 20080704 (Red Hat 4.1.2-46), check with gcc -v.

  • A more recent version (4.7.1/GCC) is also available (as of Jul 2012), under /share/apps/gcc/4.7.1, to access that version:
    • either setup your path to have /share/apps/gcc/4.7.1/bin before /usr/bin,
    • or use /share/apps/gcc/4.7.1/bin/gcc explicitly.

  • The GNU manuals are available online.

  • There is a different primer on how to use gnu compilers for OpenMPI programs


  • Trivial examples ("hello word!") are, on hydra, in ~hpc/tests/compilers.
  • Copy the content of that directory and use make -f Makefile.gnu to build the executables.
  • The file Makefile.gnu-4.7.1 will use version 4.7.1, explicitly.

-- SylvainKorzennikHPCAnalyst - 25 Jan 2012

Topic revision: r5 - 2012-07-18 - SylvainKorzennikHPCAnalyst
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2015 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback