I'm also having a hard time in finding good fortran documentation on
the web. Any suggestion for:
1) free online notes (pdf, ps, etc)
2) a good, not nosense fortran book with meaningful scientific
examples. (not Idiot guides, please ;-)).
would be very useful for me, as well.
Regards.
Look at the "Running G95" section at http://www.g95.org/docs.html .
> I'm also having a hard time in finding good fortran documentation on
> the web. Any suggestion for:
> 1) free online notes (pdf, ps, etc)
There are many links to Fortran 90/95 tutorials at the Open Directory
at
http://dmoz.org/Computers/Programming/Languages/Fortran/Tutorials/Fortran_90_and_95/
.
> 2) a good, not nosense fortran book with meaningful scientific
> examples. (not Idiot guides, please ;-)).
> would be very useful for me, as well.
"Fortran 95/2003 Explained" by Michael Metcalf, John Reid and Malcolm
Cohen is good, but it focuses on describing the language and does not
have so many examples. For more examples, you could purchase the useful
Numerical Recipes in Fortran 90 library -- the accompanying book is
online.
Let me ask more specifically:
Assume I have a file
typedefn.for
which contains the definition for the module MyMod.
What are the command line switches to get the file MyMod.mod?
The page you link maybe contains that info, but I'm not sure after
having a look at it. If I simply issue the command
g95 typedefn.for
compiler of course complains about the MAIN_ being missing. Note that
my important problem is not to be able to say -o MyMod.mod, but rather
whether this is enough to generate a module. probably not... If it's
enough, than a module file is just an object file.
What's the correct thing to do?
Thank you.
g95 -c typedefn.for
Perhaps the manual page for g95 would be useful for you?
Graham
<snip>
> Let me ask more specifically:
> Assume I have a file
> typedefn.for
> which contains the definition for the module MyMod.
> What are the command line switches to get the file MyMod.mod?
With g95 and other Fortran compilers I have used, a file foo.mod is
created automatically
when a source file containing module foo is compiled. (This is a
convention -- I don't think the Fortran standard mandates the files
containing module information be created.)
Therefore, you need only issue the command
g95 -c typedefn.for
to create MyMod.mod .
>
> The page you link maybe contains that info, but I'm not sure after
> having a look at it. If I simply issue the command
>
> g95 typedefn.for
>
> compiler of course complains about the MAIN_ being missing. Note that
> my important problem is not to be able to say -o MyMod.mod, but rather
> whether this is enough to generate a module. probably not... If it's
> enough, than a module file is just an object file.
> What's the correct thing to do?
The -o option is used to specify object files or executable names, not
module file names. As described above, the .mod files are created
automatically.
You are welcome. Speaking of conventions, I (and probably most Fortran
95 programmers) think that new Fortran code should be written using
free source form, in which case ".for" is the wrong suffix, because
most compilers will treat the code as fixed source form by default.
Your earlier post mentioned a file name with the ".for" suffix. A
".f90" suffix is better.
As i don't have access to any other compiler than g95 and gfortran, I
cannot check it myself (so i ask you experts).
Regards,
Nusret
g95 does indeed complain about lines longer than 132 characters.
I whacked a bunch of spaces between 'a' and '= 1'.
$ cat test.f90
program test
integer :: a
= 1
end program
$ g95 test.f90
Warning (115): Line 2 of test.f90 is being truncated
Graham