This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Preprocessor Directive Problems


Richard Haney wrote:
> I am new to fortran and am having some problems with a file. Whenever I try 
> to compile the file "clump.f90" using gfortran I get warnings about 
> preprocessor directives. I am using gFortran version 4.0.0. 20041001 on a 
> Linux Cluster.
> 
> The following is a short copy of my input and output:
> 
> % gfortran -c clump.f90
> 
> output: > "Warning: clump.f90:65 Unknown preprocessor directive"
> 
> When I open the file up, the line that gives the warning is "#ifdef  DEBUG".

The error message is probably misleading.  What's going on is that your source
file contains C preprocessor instructions, and hence needs to be preprocessed
before it's valid Fortran.

You have two choices: either rename your file to clump.F90 (with a capital F),
then gfortran will automatically invoke the preprocessor when compiling the
file.  Alternatively you can pass the intuitively named option '-x
f95-cpp-input' to the compiler.

- Tobi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]