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

AI Thread 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
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
0
Views
2K
Replies
16
Views
2K
Replies
1
Views
4K
Replies
6
Views
3K
Replies
9
Views
2K
Replies
19
Views
6K
Back
Top