Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Monday morning link question

longden_loo
Beginner
789 Views
After installing VS2008/IVF-11 and building the various Fortran projects, I realized that they all had the same setting for Linker / General / "Additional Library Directories", which was previously set to "$(IFORT_COMPILER10)\IA32\Lib" and which now had to be changed to "$(IFORT_COMPILER11)\Lib\IA32", obviously with the version number change, but also with the switch in the subdirectory order.

So this made me wonder if I was doing this the wrong way, since it seems like the Fortran link library location should already be known (somehow) in VS2008. Is there somewhere I can set this, rather than in every Fortran project property?

One way seems to be to set a Windows environment variable such as "LIB=%IFORT_COMPILER11%lib\ia32" and then set all Fortran projects' "Additional Library Directories" to $(LIB) ... is this the usual way everyone is doing this, or is there a better way?

Thx, Longden
0 Kudos
7 Replies
Steven_L_Intel1
Employee
789 Views
You should never need to set this for Fortran projects, and in fact shouldn't. This directory is automatically supplied and should be seen under Tools > Options > Intel Fortran > Compilers > Library Files.

If you are building mixed-language applications with a C/C++ Main, you will need to add that folder to Tools > Options > Projects and Solutions > VC++ Directories.
0 Kudos
longden_loo
Beginner
789 Views
I copied the relevant directory variable from Tools/Options/IntelFortran/Compilers/Libraries, which was

$(IFortInstallDir)libia32

... and pasted it into the top of the list for Tools/Options/Projects and Solutions/VC++ Directories, but I must still be doing something wrong cuz the build output log shows this...

8>LINK : fatal error LNK1104: cannot open file 'ifconsol.lib'
8>Project : warning PRJ0018 : The following environment variables were not found:
8>$(IFortInstallDir)

... and if I change the variable from $(IFortInstallDir) to $(IFORT_COMPILER11), then the environment variable is found, but it still complains...

8>Linking...
8>LINK : fatal error LNK1104: cannot open file 'ifconsol.lib'
8>Build log was saved at (etc. etc ...)

... and yes, this is a mixed language app (actually, a DLL) with a C++ main.
0 Kudos
Steven_L_Intel1
Employee
789 Views
You can't just change the variable name, as the directory structure has changed. Please read this KB article for the details.
0 Kudos
longden_loo
Beginner
789 Views
You can't just change the variable name, as the directory structure has changed. Please read this KB article for the details.

I got it now, thanks for that link. I was confused by your original suggestion ... "You should never need to set this for Fortran projects, and in fact shouldn't. This directory is automatically supplied and should be seen under Tools > Options > Intel Fortran > Compilers > Library Files."

In fact, that directory is given there as "$(IFortInstallDir)libia32" but $(IFortInstallDir) appears not to be defined except to the Fortran compiler, which is why I think I got the msg "...environment variables were not found: $(IFortInstallDir)" during the Link step.

When I followed your KB article link, it said to use the $(IFORT_COMPILER11) variable (which is a nuisance since that'll have to change when IVF-12 comes out), and that works.

Another bonehead error I made was to not observe (this being Monday, after all) that the VC++ Directories list is dynamic and defaults to "Executable files" which I also needed to change to "Library files" after I read the KB article (which didn't explicitly mention to do that, but showed "Library files" on the sample screen).

Of course, my 5th cup of coffee probably help to make some sense of things too:)

Thanks again Steve!

PS - My suggestion is that they should make the environment variable non-version specific.
0 Kudos
Steven_L_Intel1
Employee
789 Views
Right. The IfortInstallDir variable is defined only within a Fortran VS project - it isn't a "real" environment variable. You'll see that MSVC has similar pseudo-variable names.

I am going to submit a feature request that installing Fortran add the paths for the Fortran libraries to Visual C++'s directories.

As for IFORT_COMPILER11 - we allow mixed versions to exist on a system, and what with the folder layout changing on occasion, a single variable won't do.
0 Kudos
longden_loo
Beginner
789 Views
I am going to submit a feature request that installing Fortran add the paths for the Fortran libraries to Visual C++'s directories.

As for IFORT_COMPILER11 - we allow mixed versions to exist on a system, and what with the folder layout changing on occasion, a single variable won't do.

I just realized that your feature request might be in conflict with the installation design if mixed versions are allowed to exist.

At a minimum, that would also entail an installer pre-check for existing installed versions and then having to ask the user how to proceed. This might go against an install goal of "hands free" operation.

And if the user already had $(IFORT_COMPILER??) coded in properties / linker / general / additional library directories on the previous IVF version, then an automatic entry in VC++ Directories might muddy the waters, so to speak, as it seems the order of precedence during a link will determine which one gets actually used.
0 Kudos
Steven_L_Intel1
Employee
789 Views
A possible implementation would be that when the Fortran integration loads or the user selects a different Fortran compiler, the "correct" Fortran path is added to C++. I can see some problems with this already, though. I will discuss this with our VS experts to see if there is a better solution possible.
0 Kudos
Reply