Visual Studio 2005 Intel 9.1 Fortran IDE Integration

Visual Studio 2005 Intel 9.1 Fortran IDE Integration

Our organization uses the Subject environment.  If I build a Console Fortran Application the IDE environment works very well allowing me to edit/compile Fortran source code.

If I build a Windows application with a .cpp main and the bulk of the application Fortran I can add the Fortran  .obj's  to the project but I must maintain the Fortran source code myself (including compiles).  Just wanted to check whether this is normal behavior or if our installation is incorrect.  I've see some of Steve Lionel's comments on Resetting the environment, but those didn't do me any good.


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

I'm not entirely sure I understand the question. Here is what I am reading. You have a mixed-language application (C++/Fortran). To build this, you have a C++ executable project to which you add .cpp sources, but for the Fortran code you need to add .obj files and these are not compiled automatically. Do I have this right?

For a mixed-language application, you need to have a separate static library project for the code that is in "the other" language, Fortran in your case. Add this project to your Visual Studio solution, right click on the executable project, select Dependencies, and select the library project as a dependency. Make sure that the "Use runtime library" settings for the Fortrtan project match the "code generation" setting for the C++ project.

Visual Studio will then build the Fortran code into a library, and automatically link that library when building the C++ code. You'll need to add to the C++ settings the path to the Fortran run-time libraries as explained here. The article doesn't talk about version 9.1 but you can figure it out.

(A note for others - as of VS2010, the C++ project won't link in the Fortran library, so you need to add that library to the C++ project as explained in the article.

Retired 12/31/2016

Thanks Steve.  You pretty much do understand my situation.  If I tried to add the   .f   files as source code then Visual Studio would not know how to compile them.

I think I follow your suggestion regarding static libraries.  It sounds like what I would need to do to have Visual Studio manage the dependencies.  As a matter of fact I have three Fortran libraries that I am using in the app that are generic in nature and support most of my Fortran apps.  I could generate another .lib of the app-specific Fortran code which I think would correspond to your suggestion.  I wasn't aware that I could create another project in the solution for the Fortran code.  Sounds like an interesting experiment.

By the way - I just recently started porting my Fortran apps to Visual Studio / Intel.  It was interesting to do some Fortran Googling and have a face come up to associate with a face-less name I had often seen 15 or 20 years ago on usenet.  Thanks for your continued support.

Right - Visual Studio does not understand the concept of mixed-language projects, so a C++ project has no idea what to do with Fortran sources. You need multiple projects in a solution to make this work - a solution can have many projects.

You may want to look at the C_Calls_Fortran sample we provide to see how this is done.

Thanks for the kind words.

Retired 12/31/2016

Leave a Comment

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