Fortran How to Create an Executable in Intel Fortran Using Visual Studio?

Click For Summary
The discussion centers on a user new to programming and Fortran, specifically using Intel Fortran 9.1 with Microsoft Visual Studio 2005. The user successfully runs a debug of a simple Fortran program that sums and averages three numbers but struggles to create an executable file. They reference Intel Fortran Compiler Documentation, which explains that executables can be built by compiling source files and linking object files, either through the command line or within the Visual Studio environment. A key point made is that if the code runs, an executable has likely been created, but it may be located in a sub-directory rather than the main project directory. This indicates that the issue may not be with the code itself but rather with locating the generated executable file.
MechEng2010
Messages
12
Reaction score
0
Hello all,

I am new to programming and fortran, I have Intel Fortran 9.1 and using this via Microsoft Visual Studio 2005. To start with I have found a simple exmaple from the a Intel Fortran 90 book. I seem to be able to run a debug, but can't seem to create an executable? Its my first time using Visual Studio and Fortran. Any help would be appreciated.

PROGRAM Sum_and_Average
!
! This program reads in three numbers and sums and averages them
!
IMPLICIT NONE
REAL :: N1,N2,N3,Average = 0.0, Total = 0.0
INTEGER :: N = 3
PRINT *, 'Type in three numbers, separated by spaces or commas'
READ *,N1,N2,N3
Total= N1+N2+N3
Average=Total/N
PRINT *,'Total of numbers is ',Total
PRINT *,'Average of the numbers is ',Average
END PROGRAM Sum_and_Average

For example the Intel Visual Fortran Compiler Documentation provides this information, but no more on how to do this... can anyone help?

"Creating Fortran Executables
The simplest way to build an application is to compile all of your Intel® Fortran source files and then link the resulting object files into a single executable file. You can build single-file executables using the ifort command from the command line. For Windows*, you can also use the visual development environment.

The executable file you build with this method contains all of the code needed to execute the program, including the run-time library. Because the program resides in a single file, it is easy to copy or install. However, the project contains all of the source and object files for the routines that you used to build the application. If you need to use some of these routines in other projects, you must link all of them again.

Exceptions to this are as follows:

If you are using shared libraries, all code will not be contained in the executable file.

On Mac OS* X, the object files contain debug information and would need to be copied along with the executable."
 
Last edited:
Technology news on Phys.org
If you can run your code then you will almost certainly have created an executable. It may not be in the same directory as your Fortran - quite often in a sub-directory.
 
Yep, problem solved thanks
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 19 ·
Replies
19
Views
6K
  • · Replies 5 ·
Replies
5
Views
3K