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

Cannot compile fortran program using ifort command-line environment or visual studio

El_Noshokaty__Said
New Contributor I
3,298 Views

Hi,

On Win 10, where I have Intel parallel studio XE 2020 integrated with MS visual studio community 2019, I'm trying to compile two fortran programs; one for .exe and another for .dll. The one for .exe has succeeded (.exe created) using the ifort command-line:

ifort /O3 /nologo /assume:buffered_io /Qinit:zero /Qinit:arrays /Qparallel /integer_size:64 /real_size:64 /double_size:64 /fpconstant /fpscomp:filesfromcmd /fpscomp:ioformat /fpscomp:ldio_spacing /fpscomp:logicals /fpscomp:general /fpscomp:libs /object:"c:\sos\\" /threads /o "c:\sos\sosvoyagerprogllah1.exe" "c:\sos\lib\kernel32.lib" "c:\sos\lib\imagehlp.lib" "c:\sos\lib\msmpi.lib" "c:\sos\lib\msmpifmc.lib" "c:\sos\lib\uuid.lib" "c:\sos\lib\ifmodintr.lib" "c:\sos\lib\ifwin.lib" "c:\sos\lib\ifconsol.lib" "c:\sos\lib\libifcoremt.lib" "c:\sos\lib\libifport.lib" "c:\sos\lib\libiomp5md.lib" "c:\sos\lib\libmmt.lib" "c:\sos\lib\libirc.lib" "c:\sos\lib\svml_dispmt.lib" "c:\sos\lib\libmatmul.lib" "c:\sos\lib\libcpmt.lib" "c:\sos\sosvoyagerprogllah1.f90"

and failed in the visual studio giving the message "LINK : fatal error LNK1561: entry point must be defined". The program starts with the statement "PROGRAM".

As for the program for .dll, it fails the ifort command -line:

ifort /O3 /nologo /assume:buffered_io /Qinit:zero /Qinit:arrays /Qparallel /integer_size:64 /real_size:64 /double_size:64 /fpconstant /fpscomp:filesfromcmd /fpscomp:ioformat /fpscomp:ldio_spacing /fpscomp:logicals /fpscomp:general /fpscomp:libs /object:"c:\sos\\" /libs:dll /threads /o "c:\sos\sosvoyagerprogllah.dll" "c:\sos\lib\kernel32.lib" "c:\sos\lib\imagehlp.lib" "c:\sos\lib\msmpi.lib" "c:\sos\lib\msmpifmc.lib" "c:\sos\lib\uuid.lib" "c:\sos\lib\ifmodintr.lib" "c:\sos\lib\ifwin.lib" "c:\sos\lib\ifconsol.lib" "c:\sos\lib\libifcoremt.lib" "c:\sos\lib\libifport.lib" "c:\sos\lib\libiomp5md.lib" "c:\sos\lib\libmmt.lib" "c:\sos\lib\libirc.lib" "c:\sos\lib\svml_dispmt.lib" "c:\sos\lib\libmatmul.lib" "c:\sos\lib\libcpmt.lib" "c:\sos\sosvoyagerprogllah.f90" /DLL

giving the message "Error 7001: error in creating the compiled module file." The program starts with the statement "MODULE". And failed the visual studio by doing nothing (no .dll created), giving the message " Rebuild All: 1 succeeded, 0 failed, 0 skipped"

Said 

0 Kudos
23 Replies
El_Noshokaty__Said
New Contributor I
503 Views

Hi Steve,

You are right. I link to two mpi libraries and all is now set.

Thank you Dr. Fortran.

Said

 

0 Kudos
mecej4
Honored Contributor III
895 Views

"The reason behind the error message shown in the command prompt is that an object directory has to be specified in the ifort command line. Even though, the error message I posted earlier for the .dll program will then be displayed. The reason behind the latter error message is that a module directory has to be specified in the ifort command line too."

Neither the object directory nor the module directory "has to be specified", although you can do so if you have a reason.  In fact, I almost never specify either of these directories, and the default directories have worked fine for me for at least a decade. Similarly for the other numerous compiler options that you showed.

0 Kudos
El_Noshokaty__Said
New Contributor I
921 Views

Hi,

The reason behind the error message shown in the command prompt is that an object directory has to be specified in the ifort command line. Even though, the error message I posted earlier for the .dll program will then be displayed. The reason behind the latter error message is that a module directory has to be specified in the ifort command line too. So, I added the arguments:  /module: "c:\sos\\" for module directory and some missing .dll libraries to my ifort command line and all is now being set (/o "c:\sos\\" for the object directory is already there).

Now, my problem is to have the Visual Studio do what ifort command line has did both for the .dll and the .exe projects. This might help in debugging the project code.

Said

0 Kudos
Reply