This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Preprocessor Directive Problems
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: Richard Haney <cosmoh2o at hotmail dot com>
- Cc: fortran at gcc dot gnu dot org
- Date: Fri, 10 Jun 2005 20:55:55 +0200
- Subject: Re: Preprocessor Directive Problems
- References: <BAY107-F10C0D5F30A27C677F109F587FF0@phx.gbl>
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