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

ifort not recognized as internal or external

Alessandro_D_
New Contributor I
1,321 Views

Hi all,

 

When I type "ifort" in the Windows command line I get the following error: 

 

C:\Users\aledi>ifort
'ifort' is not recognized as an internal or external command,
operable program or batch file.

 

However, if I first change directory to the folder wher ifort.exe is located in my PC,

 

C:\Users\aledi>cd C:\Program Files (x86)\Intel\oneAPI\compiler\2022.2.1\windows\bin\intel64

 

and *then* I type ifort, everything is fine (of course I get an error because I did not specify a file, but at least the PC recognizes the ifort command)

 

My question: how can I do this once and for all, i.e. how do I add the command ifort to my windows path?

 

0 Kudos
6 Replies
andrew_4619
Honored Contributor II
1,314 Views

You need to open a command window configured for ifort. There are two shortcuts on the oneapi start menu one for 32bit environment and one for 64bit. There is much more environment needed than just the path for the ifort command.

0 Kudos
Alessandro_D_
New Contributor I
1,311 Views

Thanks for your reply. I know that the is a shortcut "Intel oneapi command promt" etc. but I would like ifort (and its related libraries) to be callable by the Windows command line. The reason is that I am using VSCode (not the Visual studio IDE that comes with Intel OneApi) and VSCode cannot find ifort because ifort is not on the path or smth

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,287 Views

The  "Intel oneapi command prompt" is the same command prompt as the Windows command prompt, with the addition of setting up the additional environment variables needed for ifort (32-bit or 64-bit) and ifx (64-bit).

 

So you can either:

 

a) select the appropriate oneAPI command prompt

  .or.

b) Open CMD, then run the appropriate setvars batch file from the oneAPI folder.

 

Jim Dempsey

0 Kudos
andrew_4619
Honored Contributor II
1,290 Views

then you would need to look at the C:\Program Files (x86)\Intel\oneAPI\compiler\2023.2.0\env\vars.bat

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,282 Views

RE: VSCode

 

You can create a batch file that runs the appropriate environment variables setup, then runs the VSCode execuitable.

And then place a shortcut to this batch file on your desktop or task bar. Something like the following untested batch file

 

 

: VSCodeLaunch.bat
call $(ONEAPI_ROOT)\compiler\latest\env\vars.bat intel64
Start VSCode

 

Jim Dempsey

 

Barbara_P_Intel
Moderator
1,262 Views

And there's the Getting Started Guide for VS Code and oneAPI.

0 Kudos
Reply