ccook
ccook

Reputation: 5959

#ifdef with gfortran 77

I am using gfortran to compile FORTRAN 77 and would like to have DEBUG build options by using the preprocessor directive #ifdef. However, when I use them I get compile time warnings "Illegal preprocessor directive". Is it possible to have this functionality without deviating from the standard toolchain?

Upvotes: 0

Views: 4729

Answers (2)

traviscj
traviscj

Reputation: 119

I fixed this issue by adding -xf77-cpp-input to my command-line options to gfortran, i.e.:

$ gfortran -xf77-cpp-input -c -g -DDEBUG fortfile.f

Upvotes: 5

ccook
ccook

Reputation: 5959

The c preprocessor can be used on the FORTRAN code for this purpose.

http://gcc.gnu.org/onlinedocs/gfortran/Preprocessing-Options.html

Upvotes: 2

Related Questions