Re: how do gfortran and ifort deal with C head files?



<s1166@xxxxxxxx> wrote:

I have a fortran package which has many .h files which are 'include'd
by fortran sources. I cated those .h files, all are #define .

I can compile the package using g95,
g95 -cpp XXX.f90
or transfer it by
g95 -cpp -E XXX.f90 > YYY.f90

but how do gfortran and ifort deal with this?

Steve has answered your basic question, but allow me to note two things.

1. These are not "C header files" (as descibed in your subject line).
They use the C preprocessor, but the resulting code had better be
Fortran code rather than C or they aren't going to do anything useful in
the Fortran compiler in any case.

2. I recommend against mixing Fortran includes and C preprocessor
directives like this. It is just asking for portability problems. The
resulting problems probably count as a FAQ here.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.



Relevant Pages

  • Re: reading more data than the record size (RECL)
    ... end snip ... This overhead is there to allow Fortran ... compile the original source code with g95, ... Think of it as a variant on the ASCII vrs ...
    (comp.lang.fortran)
  • Re: Fortran programmerss favorite report-writing tools
    ... preprocessing to compile so it's easy to add to existing code. ... same input method as when fortran was first invented. ... and the compiler is then translating it into machine code. ... a good candidate for a formulat translator seems to be texmacs. ...
    (comp.lang.fortran)
  • Re: what is wrong with this code?can someone walk me through this?
    ... i dont know anything abt fortran or coding..this is my project at ... You CAN get your program to compile if you ... What are reasonable ranges for the input variables? ...
    (comp.lang.fortran)
  • re: Upgrading an OLD (Fortran Powerstation 4.0) compiler
    ... convert and compile as f90 and fix any errors ... compiler options for windows - most vendors have 30 day demo versions. ... ivf - Intel Visual fortran, ... SUBROUTINE FortranCall ...
    (comp.lang.fortran)
  • Re: Toward a Forth thats easier to learn
    ... Barriers cease to be barriers once you're past them. ... For variables, what emerged as a style in the early days was a compromise: LSE users put in more variables than a Forth purist, but fewer than a Fortran programmer. ... Compile a line and either save it or execute it and throw it ...
    (comp.lang.forth)