Program won't compile (Fortran 77)

  • Context: Fortran 
  • Thread starter Thread starter Nano-Passion
  • Start date Start date
  • Tags Tags
    Program
Click For Summary

Discussion Overview

The discussion revolves around a Fortran 77 program that fails to compile, with participants exploring potential causes for the compilation errors and suggesting solutions related to file naming conventions and extensions.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant presents a simple Fortran 77 program and describes the compilation error encountered, indicating a potential issue with file format recognition.
  • Another participant suggests that the problem may not be related to syntax but rather to the compiler misreading the file due to its naming convention.
  • A different participant questions the use of the ".~f" file suffix, recommending more conventional extensions like .f77, .F77, .f, or .F.
  • One participant acknowledges that the program automatically generated the ".~F" suffix and confirms that changing it to .F resolved the issue.
  • Another participant speculates that the original file may have lacked an extension entirely, which could have contributed to the compilation problem.

Areas of Agreement / Disagreement

Participants generally agree that the file extension is a critical factor in the compilation issue, but there are differing views on the exact cause and the implications of the file naming conventions.

Contextual Notes

Some assumptions about the compiler's behavior and the specific requirements for file extensions in Fortran 77 are not fully explored, leaving room for further clarification.

Nano-Passion
Messages
1,291
Reaction score
0
This is my program:

PROGRAM practice

integer:: A

Read*, A

print*, A

END PROGRAM

Very simple program, just a test. I'm using "Force 2.0" for Fortran 77

But this keeps coming out

C:\Program Files\Force 2.0\bin\ld.exe:C:\Users\Dr. Ghobrial\Desktop\Source2.~f: file format not recognized; treating as linker script
C:\Program Files\Force 2.0\bin\ld.exe:C:\Users\Dr. Ghobrial\Desktop\Source2.~f:1: syntax error
collect2: ld returned 1 exit status


Any ideas?
 
Technology news on Phys.org
Judging from the output problems have nothing to do with the syntax, rather the compiler is trying to read wrong file.

But that's just a guess, I have never used Force (too low level of midi-chlorians).
 
Using ".~f" as a file name suffix seems a strange idea, unless the Force 2.0 documentation told you to do that.

Try .f77, .F77, or even just .f or .F (often f and F indicate the source code is in fixed format or free format).
 
Borek said:
Judging from the output problems have nothing to do with the syntax, rather the compiler is trying to read wrong file.

But that's just a guess, I have never used Force (too low level of midi-chlorians).

:smile:

AlephZero said:
Using ".~f" as a file name suffix seems a strange idea, unless the Force 2.0 documentation told you to do that.

Try .f77, .F77, or even just .f or .F (often f and F indicate the source code is in fixed format or free format).

I didn't put .~F, the program did that automatically.

.F worked though, thank you!
 
I'm guessing that you didn't have a file extension at all - that your file's name was Source2, with no extension. The compiler was probably looking for any files with a .F or similar file extension.
 
Mark44 said:
I'm guessing that you didn't have a file extension at all - that your file's name was Source2, with no extension. The compiler was probably looking for any files with a .F or similar file extension.

Yep you guessed right. It was a silly mistake, I haven't programmed in a while.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 16 ·
Replies
16
Views
6K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
5K
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 19 ·
Replies
19
Views
7K
  • · Replies 6 ·
Replies
6
Views
2K