Fortran Program won't compile (Fortran 77)

  • Thread starter Thread starter Nano-Passion
  • Start date Start date
  • Tags Tags
    Program
Click For Summary
The discussion revolves around a simple Fortran 77 program that encounters a linker error due to an incorrect file extension. The user reports receiving a syntax error related to a file named "Source2.~f," which the compiler does not recognize. Suggestions are made to use more conventional file extensions such as .f77, .F77, .f, or .F, which indicate the format of the source code. The user confirms that the program automatically assigned the .~f extension, leading to confusion. Ultimately, changing the file extension to .F resolves the issue, highlighting the importance of using appropriate file naming conventions in programming to avoid compilation errors.
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.
 
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

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