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

Starting visual studio with compiler version option

Andrew_Smith
Valued Contributor I
873 Views
I need to support old versions of my software so I keep several versions of Intel Fortran Installed.

In order to select the correct version in Visual Studio I have a script file which prompts me to select the version and sets IFORT_COMPILER11 to the compiler directory. This works because it overrides whatever setting is saved in Visual Studio.

Now that we have Visual Fortran 12 we have a new environment variable IFORT_COMPILER12. How do these two variables interact?

Here is my idea for my new script but it does not find the compiler when I select 12.0:

@echo off
rem #****************************************************
rem # Compiler
rem #****************************************************

echo Compiler Version
echo 1 ivf 12.0
echo 2 ivf 11.1.067
echo 3 ivf 11.0.074

set /p ans=Select compiler [1]

if '%ans%'=='' set ans=1
if '%ans%'=='1' set IfortInstallDir="C:\\Program Files (x86)\\Intel\\ComposerXE-2011\\"
if '%ans%'=='2' set IfortInstallDir="C:\\Program Files (x86)\\Intel\\Compiler\\11.1\\067\\"
if '%ans%'=='3' set IfortInstallDir="C:\\Program Files (x86)\\Intel\\Compiler\\11.0\\074\\fortran\\"

set IFORT_COMPILER12=%IfortInstallDir%
set IFORT_COMPILER11=%IfortInstallDir%
call %IfortInstallDir%bin\\ifortvars ia32 vs2008
set IfortInstallDir

set PATH=%path%;%vspath%

cd %vse%\\RomaxDevelopment

devenv /useenv
0 Kudos
5 Replies
psantos
Beginner
873 Views
Hello Andrew,

You can simply switch from IVF versions using VS options. Just go to Tools>Options>Intel Visual Fortran>Compilers.

Pedro
0 Kudos
Andrew_Smith
Valued Contributor I
873 Views
Yes I knew that but it is so easy to forget to select the correct version and waste 20 minutes compiling for the wrong version.

My prompt also shows my software version but I deleted those for my post.

It also enables you to have several Visual Studio copies open at a time with each having different version settings. This is great for comparing old and new software for changes at runtime.

Andy
0 Kudos
Steven_L_Intel1
Employee
873 Views
Open the command prompt environment for the version you want and type:

devenv /useenv

This will use the environment you set up from the command line.
0 Kudos
Andrew_Smith
Valued Contributor I
873 Views
Thanks Steve. So here is the guts needed for the last three versions of Fortran:

@echo off
echo Compiler Version
echo 1 MySoftware V3
echo 2 MySoftware V2
echo 3 MySoftware V1

set /p ans=Select compiler [1]

if '%ans%'=='' set ans=1
if '%ans%'=='1' call "C:\Program Files (x86)\Intel\ComposerXE-2011\bin\ipsxe-comp-vars.bat" ia32 vs2008
if '%ans%'=='2' call "C:\Program Files (x86)\Intel\Compiler\11.1\067\bin\ifortvars.bat" ia32
if '%ans%'=='3' call "C:\Program Files (x86)\Intel\Compiler\11.0\074\fortran\Bin\ifortvars.bat" ia32

"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv" /useenv
0 Kudos
Steven_L_Intel1
Employee
873 Views
That is correct.
0 Kudos
Reply