From: Markus Franke on
Hello,

I have Fortran 90 code and want to include a file (config.h) with
C-style comments, like /* */. When I try compile the file with IBM XLF
10.1 Compiler I get the following error messages:

---snip---
"../../config.h", line 1.0: 1515-005 (S) Continuation line is not
permitted at beginning of program or after INCLUDE, EJECT, @PROCESS
statements or comment directive. Line is ignored.
"../../config.h", line 2.0: 1515-005 (S) Continuation line is not
permitted at beginning of program or after INCLUDE, EJECT, @PROCESS
statements or comment directive. Line is ignored.
"../../config.h", line 4.0: 1515-005 (S) Continuation line is not
permitted at beginning of program or after INCLUDE, EJECT, @PROCESS
statements or comment directive. Line is ignored.
"../../config.h", line 5.0: 1515-005 (S) Continuation line is not
permitted at beginning of program or after INCLUDE, EJECT, @PROCESS
statements or comment directive. Line is ignored.
---snap---

These lines are all comment lines in "/* */" - style. I tried to use
several different compiler options but nothing solved the problem.

Any suggestions?

Thanks for help,
Markus Franke
From: Patrick Begou on
If you want to include a file in a fortran source file, it should follow
the fortran grammar. You cannot include C langage files in fortran
source code.
From: Markus Franke on
Hi,

Patrick Begou wrote:
> If you want to include a file in a fortran source file, it should follow
> the fortran grammar. You cannot include C langage files in fortran
> source code.

well I know that this is weird :-) But it is not my code and I just try
to get it compiled.

Greets,
Markus
From: simon on
Well you haven't given any examples of what you have tried so it's a
little hard to help. What you could try (and this works for g95) is to
use the c-preprocessor syntax:

#include "config.h"

and then use compiler options to ensure that the c-preprocessor is run
on the code prior to the fortran compiler. On g95 this is done with the
cpp option:

g95 -cpp -c fred.f90


Simon Geard

From: Markus Franke on
Hi,

simon(a)whiteowl.co.uk wrote:
> Well you haven't given any examples of what you have tried so it's a
> little hard to help. What you could try (and this works for g95) is to
> use the c-preprocessor syntax:
>
> #include "config.h"

that's what I am doing.

>
> and then use compiler options to ensure that the c-preprocessor is run
> on the code prior to the fortran compiler. On g95 this is done with the
> cpp option:
>
> g95 -cpp -c fred.f90

Would be nice if there is such an option in XLF but there is none.
In fact I tried to use "-qsuffix=cpp=F90" to invoke the CPP for my
sourcecode files which end on *.F90. I think IBM XLF uses the CPP for
standard as can figure out from the Manpages. I also tried to set the
CPP environment variable explicitly to "/usr/bin/cpp" but without any
success.


Regard,
Markus Franke
 |  Next  |  Last
Pages: 1 2 3
Prev: silverfrost IDE
Next: Stack size, and warnings