Reputation: 1307
I'm working with a very large piece of mortran code. I'm trying to compile it on my own machine, and the mortran part goes ok, but the fortran compile fails.
On both machines I'm using gfortran with the same flags (-fPIC
).
Machine 1:
Linux [omitted] 2.6.18-194.3.1.el5 #1 SMP Fri May 7 01:43:09 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
with gfortran 4.1.2 (Working - very old kernel)
Machine 2:
Linux [omitted] 4.4.0-79-generic #100-Ubuntu SMP Wed May 17 19:58:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
with gfortran 5.4.0 (Not working)
The error (most of the time) I'm getting is:
Error: Invalid character in name at (1)
ExIN=$ExDEF
1
There's also a few errors about var has no implicit type
.
I don't have much experience with fortran, but I'd expect compilers to be consistent across platforms, especially since this was developed with the intent of being cross-platform.
Edit - it looks like I had a different version of the mortran compiler. I'm going to try to find the old version and see if that does it. They are mortran macros and they are supposed to expand to something.
Upvotes: 1
Views: 557
Reputation: 60078
Dollar is not a valid character of the Fortran character set.
Some compilers allow it by extension. To allow it in GNU Fortran, but not as first character and only if the target system supports it, use
-fdollar-ok
See https://gcc.gnu.org/onlinedocs/gfortran/Naming-conventions.html
Looks like you are out of luck with this compiler.
You may try g77 with the same option, see https://gcc.gnu.org/onlinedocs/gcc-3.4.5/g77/Dollar-Signs.html
The old gfortran 4.8.1 also does not speak about the initial letter restriction
-fdollar-ok Allow `$' as a valid character in a symbol name.
Upvotes: 2