How to complie the fortran code?

How to complie the fortran code?

I am trying to use Intel Visual Fortran (IVF) and Visual Studio 2013 to run with my code which was run on Digital Visual Fortran (DVF).
The code includes two files, which are main program (main.f90) and subroutine, respectively. I can run the code on DVF correctly.

When I compiled the code with IVF, however, I got two problems:

1) How to compile fortran code without project?

When using DVF to compile the code, I can open the main program directly (double left clicks) and add subroutine before I build them up and run the code. When using IVF, however, I cannot run the code in the way I used with DVF. When I directly open the main.f90 with IVF, the function of "build up" become not available.Moreover, I cannot find the button to add the file to the main program. How to compile the code without out project?

2) Cannot compile fortran code in a project.

Since I cannot run the code on IVF with directly open the code without project, I created a project for the code. The code was moved to the folder under the project. Then, I opened the project, and added the main.90 and subroutine files through the "Solution Explorer". There was no error when I built it up. I can run the code, but it cannot run correctly (dispersed abnormally which didn't occur when compiling the code with DVF).

I think I need somebody's help......

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

1) You can't do that - sorry.

2) It sounds as if you can run the program, but it behaves differently than it did with DVF. That is not a general issue with running programs. You'll need to debug the program to see why you get different results.

By the way, you didn't need to move the source file. No problem that you did, but it wasn't required.

Retired 12/31/2016

Hi Steve,

A breakpoint was triggered when I compiled the code.
The console window showed that "forrt1: severe <24>: end-of-file during read, unit2" (as attached image).

The code stopped at the place shown below

DO I=1,L1
  DO J=1,M1
     READ(2,"(1XE15.7)") yy
END DO                                                                                                                               ================================================

The code is fine for DVF, and the y.txt file has enough information for reading.
Is it the Syntax error for IVF? 


Downloadimage/png error_0.png10.17 KB

There's no syntax error. Most likely is that the file y.TXT did not exist in the project folder where it is looked for by default. If you did an OPEN without STATUS='OLD', it would have created a new, empty file that then got an end-of-file on READ. This is exactly the same behavior as CVF/DVF.

Retired 12/31/2016

You are right!!! The .txt file is not under the folder from which the compiler loaded. Hence, an empty .txt file was created for reading. The error was fixed after I moved the correct .txt file to the folder.

Thanks Steve.

Leave a Comment

Please sign in to add a comment. Not a member? Join today