If Your Code Will Not Compile...

Read through your compiler listing file carefully, looking for the error messages indicating which statements caused the errors. Compiler options to create a listing file include:

  • IBM:
    • IBM Fortran (xlf, xlf90, xlf95): -qsource option
    • IBM C (xlc) and C++ (xlC): --qLIST option
    • GNU Fortran/C/C++: Please refer to the GNU compiler man pages
      man gcc (C), man g++ (C++), man g77 (Fortran)
  • Linux:
    • Intel Fortran: Please refer to the Intel Fortran Compiler User Guide
      /usr/local/tools/ifort/Documentation/en_US/documentation_f.htm
    • Intel C/C++: Please refer to the Intel C/C++ Compiler User Guide
      /usr/local/tools/icc/Documentation/en_US/documentation_c.htm
    • PGI Fortran/C/C++: Please refer to the PGI User Guide
      /usr/local/tools/pgi/doc/index.htm
    • Pathscale Fortran/C/C++: Please refer to the Pathscale User Guide
      /usr/local/tools/pathscale/share/doc/pathscale-compilers-3.2.99/UserGuide.pdf
    • GNU Fortran/C/C++: Please refer to the GNU compiler man pages
      man gcc (C), man g++ (C++), man gfortran (Fortran)

Some compilers only send the errors to standard out. If you have many errors, consider redirecting the errors to a file. For example,

cc code.c >& code.err

where code.c is the file being compiled and standard out, if any, will be written to the file code.err. Look carefully at the errors, which usually indicate the line number within the source code where the error was detected.

If you do not understand the meaning of an error, check the compiler documentation. If you still need help, contact the LC Hotline for assistance.

Occasionally, the compiler is not able to complete (e.g., it abnormally terminates with an error). Contact the LC Hotline for assistance. We may be able to refer you to other versions of the compiler to try, or we may be able to isolate the problem within the code. However, in all such cases, we would like to have an example that reproduces the problem so we can report it to the compiler vendor.

Top