0

I am trying to compile a old Fortran application, original written for Microsoft Fortran (v3.3 1985, F77) using GNU Fortran.

The bigger question: What is the easiest way to compile a Microsoft Fortran DOS application compiling to a binary for Windows?

I get a large number of errors if I try to compile this code using f77, mainly in printing output (to screen/file). How can I fix?

   110 FORMAT(/,10X,'    Enter action : '\)
                                         1
Error: Unexpected element ‘\’ in format string at (1)
APP1.FOR:107:20:

   120 WRITE(*,'(1X,2A\)')CH,'[2J'
                    1
Error: Unexpected element ‘\’ in format string at (1)
APP1.FOR:121:44:

What is the syntax of WRITE?

   120 WRITE(*,100)
                 1
Error: FORMAT label 100 at (1) not defined
3
  • 1
    The \ in a format string is a non-standard extension supported by some compilers that suppresses a newline after the output (so reading input happens on the same line as the prompt). There is no equivalent in standard Fortran 77. The syntax WRITE(*,100) is valid, but for it to work, there needs to be a format statement with label 100 in the same subprogram (akin to the format 110 you have shown). The compiler is telling you there is no such format statement in that sub-program. Commented Oct 13, 2017 at 14:18
  • The main line from my - now moved to the other question - answer: "The backslash is not valid in Fortran 77 FORMAT statements. Gfortran will not compile it, unless you fix the code." Commented Oct 13, 2017 at 14:22
  • "What is the easiest way to compile a Microsoft Fortran DOS application compiling to a binary for Windows?" That is quite a different question, for a different post, but very likely too broad. There are simply too many issues depending on what kind of non-standard problems you are currently hitting. The code you show can probably be compiled with Intel Fortran (costs money). Commented Oct 13, 2017 at 14:24

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.