user32882
user32882

Reputation: 5877

Running simple fortran programs using Intel Visual Fortran + Microsoft Visual Studio

I have recently acquired a copy of Microsoft Visual Studio 2012 and Intel Parallel Studio Visual Fortran Compiler XE 2013.

I am familiar with neither the use of Microsoft Visual Studio nor Fortran as a programming language in general. My objective is to come up with a simple construct/framework in which I can generate and test basic Fortran programs/output in order to learn the Fortran language. This would be similar to using a basic Fortran compiler such as GNU and running things like "hello world" type programs through the command prompt. I am however restricted to the two applications above for reasons not relevant to discuss here.

It seems that Visual Studio does not allow the user to compile/build individual source files if they are not playing some kind of role in the more general project solution (One would have to create, compile and build a separate project for each tiny Fortran program). As described by this post, Visual Studio does not allow this for apparently very good reasons.

I also found this video which describes an apparently simple way to use the ifort command in order to compile and run a simple Fortran program using Intel Visual Fortran. Unfortunately when I try this on my OS, I get the following error message:

ifort: error #10037: could not find 'link'

Although it does successfully generate an object file with the same name, though no executable.

The plausible fix to this error is the following quote which I found on an Intel forum

"the error "cannot find link" is almost always caused by not installing the 64-bit compiler and tools component of Visual Studio"

I do not have administrator privileges on this machine for similar reasons to those for which I am only restricted to the above two applications. For this reason I cannot apply the above fix. Furthermore I do not believe the compiler is not working for this reason.

Again, all I need is a straightforward way to write, compile and run simple Fortran code. As mentioned above, I have attempted several ideas and so my only option is to solicit guidance. Since Visual Studio can build commercial quality applications and Visual Fortran can perform parallel processing with Fortran, I am inclined to think these should be able to cover this basic need.

EDIT

I just ran ifortvars.bat in windows cmd and still get the same error. Please see below for ifortvars output.

enter image description here

EDIT 2

In response to Steve's answer, here are a few commands I ran using the Intel Fortran command prompt. As you can see the problem persists.

enter image description here

Upvotes: 0

Views: 5121

Answers (1)

Steve Lionel
Steve Lionel

Reputation: 7267

If Intel Parallel Studio is correctly installed on your system, you should find in the Start menu an entry something like Intel Parallel Studio XE 2013. Under that (may be in a subfolder) will be an entry something like "Intel Parallel Studio XE with Intel Compiler 13.0". Click that. It opens a command prompt window. cd to the folder containing your source file and use:

ifort yoursourcefile.f90

to compile and link. It is true that in Visual Studio you have to have a project and solution to build an application, but that is pretty easy. Documentation is installed on your computer but also see https://software.intel.com/en-us/node/677903 - this is for the current version but yours will be the same.

Upvotes: 1

Related Questions