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

fortran ifx using win11

ProfPeter
Beginner
1,323 Views

I can not use ifx using *.cmd. files. Path not found for intel\.... because  a blanc in "Programme (x86)\....

I copied intel.. from \Programme (x86)\intel.. to an new dir \myintel\ and  can compile and find *.obj. But can not link > link not found.   

Please help.

Best wishes

ProfPeter

0 Kudos
13 Replies
Arjen_Markus
Honored Contributor I
1,315 Views

Did you use the Intel oneAPI prompt window to start the batch file? I have no problem running the compiler and linker via this prompt.

Devorah_H_Intel
Moderator
1,241 Views

See the Get Started Guide for Intel Fortran Compiler on Windows as well:  https://www.intel.com/content/www/us/en/docs/fortran-compiler/get-started-guide/2025-0/get-started-on-windows.html 

0 Kudos
ProfPeter
Beginner
1,211 Views

Hello,

have you used Win11? I want to use command files *.cmd only, because my fortran program has 800 subroutines with about 200 statements per program. I use Fortran since 1965! I use no other tools like MVStudio etc.

If I run  setvars.bat I get some errors > path not found, because blanc in path (see my mail). 

I have hat no problems on my old PC using ifort under Win10, but the hard-disc is damaged now! 

Best wishes

ProfPeter

0 Kudos
ProfPeter
Beginner
1,010 Views

Hello dear support team,
I can compile my test program test.f and get test.exe now. After de-installation and new installation of intel fortran under c:\intel, 
I run "C:\Intel\oneAPI\setvars.bat" and additional "C:\MicrosoftVisualStudio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" !
Missing vcvars64.bat is the problem!


Now I try to run my script using libs, see DOS-Window below >> "path not found (Das System kann den angegebenen Pfad nicht finden.)
"
Please help!
Best wishes
ProfPeter

 

 

>>> my cmd > %1 ist aknos

:: erstellt fuer TP2x aus allen .f-Dateien eines Unterverzeichnisses eine .lib-Datei
:: im Unterverzeichnis \TP2x\Wtp2000\Tp2000\module\wn64\libs\apps\
@Echo %1
@mkdir tp_apps\%1\obj64
@DEL /q tp_apps\%1\obj64\*
%ifort% -object:tp_apps\%1\obj\ -c %FFLAGS% -Itp_opensc\include\wn64 -Itp_opensc\include /Qdiag-file:tp_apps\%1\obj64\error.txt tp_apps\%1\*.f
/for/libs /out:\TP2x\Wtp2000\Tp2000\module\wn64\libs\apps\%1.lib

>>> meine Ausführung im DOS-Window

C:\Wtp2000\Source\tp_source>build_tp2000_aknos_wn64

C:\Wtp2000\Source\tp_source>call tp_build_subdir_tp_apps_wn64 aknos
aknos Ein Unterverzeichnis oder eine Datei mit dem Namen "tp_apps\aknos\obj64" existiert bereits.
C:\Wtp2000\Source\tp_source>"c:\Intel\oneAPI\compiler\latest\bin\ifx.exe"
-object:tp_apps\aknos\obj\ -c /names:lowercase /libs:static -threads -fpp -names:lowercase -debug:none -check:bounds -check:uninit
-Iinclude -traceback -

DBUILDTAG="'20.30__12.01.2025_12:28__igfgr__win64'" /iface:nomixed_str_len_arg /iface:cref -nologo
-Itp_opensc\include\wn64 -Itp_opensc\include /Qdiag-file:tp_apps\aknos\obj64\error.txt tp_apps\aknos\*.f

C:\Wtp2000\Source\tp_source>/for/libs /out:\TP2x\Wtp2000\Tp2000\module\wn64\libs\apps\aknos.lib

Das System kann den angegebenen Pfad nicht finden.

 

C:\Wtp2000\Source\tp_source>echo \TP2x\Wtp2000\Tp2000\module\wn64\libs\apps\
\TP2x\Wtp2000\Tp2000\module\wn64\libs\apps\

 

>>>>>>> Remark:
echo shows the correct path of my libs, >Problem: "/for/libs /out:" correct path name of intel libs!!

 

0 Kudos
Igor_V_Intel
Employee
869 Views

Your compilation command looks correct:

C:\Wtp2000\Source\tp_source>"c:\Intel\oneAPI\compiler\latest\bin\ifx.exe"

-object:tp_apps\aknos\obj\ -c /names:lowercase /libs:static -threads -fpp -names:lowercase -debug:none -check:bounds -check:uninit

-Iinclude -traceback -

DBUILDTAG="'20.30__12.01.2025_12:28__igfgr__win64'" /iface:nomixed_str_len_arg /iface:cref -nologo

-Itp_opensc\include\wn64 -Itp_opensc\include /Qdiag-file:tp_apps\aknos\obj64\error.txt tp_apps\aknos\*.f


However, the linking command doesn't look correct:

C:\Wtp2000\Source\tp_source>/for/libs /out:\TP2x\Wtp2000\Tp2000\module\wn64\libs\apps\aknos.lib

It should be a linker command to produce the library. I guess you missed a part of the command somehow.



0 Kudos
ProfPeter
Beginner
859 Views

I I agree, but tell me this linker command.

Thank you!

Best wishes

ProfPeter

0 Kudos
Igor_V_Intel
Employee
849 Views

It depends on what exactly you want to link in the final library. Here is the example of the trivial compilation and link commands:


ifx -c *.f

link /lib *.obj /out:test.lib


In you case you compile all Fortran sources (*.f) from tp_apps\aknos and produce all object files to tp_apps\aknos\obj.

I assume you want to link all these files to the aknos.lib in \TP2x\Wtp2000\Tp2000\module\wn64\libs\apps. To do that you may try to invoke the command


link /lib tp_apps\aknos\obj\*.obj /out:\TP2x\Wtp2000\Tp2000\module\wn64\libs\apps\aknos.lib


I am pretty sure that this script you are trying to execute with ifx doesn't work with ifort. Something is corrupted there.

Note that you don't need to invoke the ifx with a full path to the binary. I recommend you to run the cmd (command shell) with the preset environment for Intel Fortran compiler and Visual Studio, e.g. type in the Search on the bottom of your Windows desktop 'oneAPI' and then click on the shortcut 'Intel oneAPI command prompt for Intel 64 for Visual Studio 2022'. It will open a command line with the set environment and you may simply invoke ifx, link etc. Note that paths to the required Intel libraries are also set in that case.



0 Kudos
ProfPeter
Beginner
736 Views

Thank you so much.  

After running 

"C:\MicrosoftVisualStudio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
"C:\Intel\oneAPI\setvars.bat"

I use include files in *.f under "tp_opensc\include\wn64)" and "tp_opensc\include"

I try this command at command line: 

 

C:\Wtp2000\Source\tp_source>ifx -c tp_apps\aknos\*.f %FFLAGS%

-Itp_opensc\include\wn64 -Itp_opensc\include link /lib tp_apps\aknos\obj\*.obj /out

:\TP2x\Wtp2000\Tp2000\module\wn64\libs\apps\aknos\lib
ifx: warning #10446: /check:uninit is not currently available on windows.
ifx: command line warning #10161: unrecognized source type 'link'; object file assumed
ifx: command line error: option '/lib' is ambiguous

 

Best wishes,

ProfPeter

0 Kudos
Igor_V_Intel
Employee
721 Views

Please don't forget to execute the link command as a separate one. You tried to make it a part of ifx command.

Please execute first the compilation with ifx:


ifx -c tp_apps\aknos\*.f %FFLAGS%

-Itp_opensc\include\wn64 -Itp_opensc\include


And then a new command with link:

link /lib tp_apps\aknos\obj\*.obj /out

:\TP2x\Wtp2000\Tp2000\module\wn64\libs\apps\aknos\lib


0 Kudos
Igor_V_Intel
Employee
718 Views

Note that in your original compilation command, you set the output path via the -object:tp_apps\aknos\obj option. In the linking command we are trying to pass it as tp_apps\aknos\obj\*.obj (to find all object files compiled on the compilation step). Please don't forget -object:tp_apps\aknos\obj (maybe you have it %FFLAGS%)


0 Kudos
ProfPeter
Beginner
651 Views

Hello,

the problem was %FFLAGS%,

FFLAGS=/names:lowercase -threads -fpp -names:lowercase -debug:none -check:bounds -Iinclude -traceback -DBUILDTAG="'20.30 __21.01.2025_12:01__igfgr__win64'" /iface:nomixed_str_len_arg /iface:cref -nologo /libs:static

it includes "/libs:static"

I deleted it and inserted it to my DOS-Window command >

ifx -c tp_apps\aknos\*.f tp_apps\aknos\obj\*.obj %FFLAGS%                                 -Itp_opensc\include\wn64 -Itp_opensc\include /libs:static /out:\TP2x\Wtp2000\Tp2000\module\wn64\libs\apps\aknos.lib

ifx: command line warning #10158: ignoring option '/o'; argument must be separate
ifx: warning #10145: no action performed for file 'tp_apps\aknos\obj\akauf.obj'

>> and all *.obj of other subroutines

 

I find all *.obj not in path "tp_apps\..." but in my working directory. 

If I insert -object:tp_apps...... > I got no *.obj!

But 2 messages:

ifx: command line warning #10158: ignoring option '/o'; argument must be separate
ifx: command line error: multiple sources; obj output option must specify dir

Pleas can you help me?

Best wishes

ProfPeter

0 Kudos
Igor_V_Intel
Employee
608 Views

The compiler behavior is correct. You tried to execute the following command

ifx -c tp_apps\aknos\*.f tp_apps\aknos\obj\*.obj ...

Note that with 'tp_apps\aknos\*.f' you passed the location of source files. However, for some reason, you also pass 'tp_apps\aknos\obj\*.obj' with no additional options in front, so the compiler driver (ifx command) recognizes this as a set of source files to compile. You need to add an options /objects (https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2025-0/object.html), e.g. -object:tp_apps\aknos\obj\

 

 

I recommend you create 2 Fortran source files with some example code and play a bit with the compilation and linking of these files.

Compile with 

ifx -c *.f90 /object:test\obj\

And then link with 

link /lib test\obj\*.obj /out:test.lib

 

You may also find some additional information about compilation and linking in the Internet, e.g. 

https://fortran-lang.org/en/learn/building_programs/

 

We also have a chapter in our documentation on that:

https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2025-0/compile-and-link-intel-fortran-and-c-c-programs.html

 

In your case the following command should work:

ifx -object:tp_apps\aknos\obj\ -c /names:lowercase /libs:static -threads -fpp -names:lowercase -debug:none -check:bounds -check:uninit -Iinclude -traceback -DBUILDTAG="'20.30__12.01.2025_12:28__igfgr__win64'" /iface:nomixed_str_len_arg /iface:cref -nologo -Itp_opensc\include\wn64 -Itp_opensc\include /Qdiag-file:tp_apps\aknos\obj64\error.txt tp_apps\aknos\*.f

 

link /lib tp_apps\aknos\obj\*.obj /out:\TP2x\Wtp2000\Tp2000\module\wn64\libs\apps\aknos.lib

 

Also note that copying these commands from the browser may result in additional breaks between some compiler options. Please remove any unnecessary breaks and execute only 2 commands (ifx to compile and produce object files, and then link to link all object files to the library).

 

0 Kudos
ProfPeter
Beginner
557 Views

image002.jpg  this was 20 years ago, now I am 86

Hello

I tried your recommendation with ifx and link.

Three cheers , it runs !!! 

I embrace and thank you so much.

Best wishes

ProfPeter

 

0 Kudos
Reply