Hi, I am having these errors compiling with Microsoft Visual Studio (on Windows).
error LNK2001: unresolved external symbol _VDCDFNORM computeNewSteadyState_MOD.obj
error LNK2019: unresolved external symbol _DGEEV referenced in function _LINEARALGEBRA_MOD_mp_EIGEN LinearAlgebra_MOD.obj
I believe the Properties are set correctly:
Configuration Porperties>Fortran>Libraries>Use Intel Math Kernel Library: Sequential (/Qmkl:sequential)
The command line is:
/nologo /debug:full /Od /heap-arrays0 /Qopenmp /warn:interfaces /module:"x64\Debug\\" /object:"x64\Debug\\" /Fd"x64\Debug\vc150.pdb" /traceback /check:bounds /check:stack /libs:static /threads /Qmkl:sequential /c
Any tips? I have been able to compile very similar programs using the options above, so I am quite confused.
The command that you showed contains the /c option, and the /Qmkl:... option enables USE ... statements associated with MKL modules to be compiled using the .MOD files that are made available at compile time.
You need a corresponding /Qmkl option for the linking step, so that the necessary MKL .LIB files are scanned by the linker.. Check the linker command line.
Thank you. This is the command line for the linker:
/OUT:"x64\Debug\Project_Transition_NoMobilityCosts.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"x64\Debug\Project_Transition_NoMobilityCosts.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\rd699\Dropbox\TradeDeficitsLabor\Fortran\QJE_Revision\Project_Transition_NoMobilityCosts\Project_Transition_NoMobilityCosts\x64\Debug\Project_Transition_NoMobilityCosts.pdb" /SUBSYSTEM:CONSOLE /STACK:100000000 /IMPLIB:"C:\Users\rd699\Dropbox\TradeDeficitsLabor\Fortran\QJE_Revision\Project_Transition_NoMobilityCosts\Project_Transition_NoMobilityCosts\x64\Debug\Project_Transition_NoMobilityCosts.lib"
I don't see how I can set the option you are referring to under Properties>Linker in Microsoft Visual Studio.
Using Intel OneAPI with VS2019 on Windows-10 X64, the setting is:
Right click on project name in Solution Explorer of VS. In the project property pages window that then pops up, select Configuration Properties -> Fortran -> Libraries, and set "Use Intel Math Kernel Library" to an option other than "No".
If you use other versions of Ifort and VS, adapt to suit.
Your settings appear to be fine, so I do not know what is going wrong with your build.
I just now tried a test MKL build with a simple one-file Fortran program that calls a couple of MKL routines. It appears that the dependence on MKL libraries is now embedded in the OBJ files as if
!DIR$ OBJCOMMENT LIB:<mkl_libraries>
had been included in the source file from which the OBJ file was compiled, rather than by listing MKL libraries in the linking command line. Here is my build log for the simple project:
Deleting intermediate files and output files for project 'tmkl', configuration 'Release|Win32'. Compiling with Intel® Fortran Compiler Classic 2021.4.0 [IA-32]... ifort /nologo /O2 /module:"Release\\" /object:"Release\\" /Fd"Release\vc160.pdb" /libs:dll /threads /Qmkl:sequential /c /extfor:f /Qlocation,link,"C:\LANG\VS19\VC\Tools\MSVC\14.28.29333\bin\HostX86\x86" /Qm32 "T:\lang\mkl\tmkl.f" Linking... Link /OUT:"Release\tmkl.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"Release\tmkl.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /IMPLIB:"T:\lang\mkl\tmkl\Release\tmkl.lib" -qm32 /qoffload-ldopts="-mkl=sequential" "Release\tmkl.obj" Embedding manifest... mt.exe /nologo /outputresource:"T:\lang\mkl\tmkl\Release\tmkl.exe;#1" /manifest "Release\tmkl.exe.intermediate.manifest" tmkl - 0 error(s), 0 warning(s)
Compare this to your build log (which is most probably much longer, since your project is more complex and involves many source files and possibly third party libraries) to see if there is something that is obviously in need of fixing.