Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Diffuculties in linking intel fortran MKL library in MSVS15

Yuwei_Z_
Beginner
312 Views

Hi! Thanks in advance for spending time reading the thread and offering your precious advice and insight.

I am using MSVS15 + Intel Parallel Studio 17. I am compiling the example project from this address. If you go down on the page or search for 'DFT_RtoCCS.zip' you will immediately find the project.

The example project works fine until I build a new project and copy the source files over there. I basically set up everything (including path, linker lib path, additional dependencies) exactly the same way as the old project. It doesn't work whether I use step 3 or step 4 to configure the static libraries. The linker complains:
 

Severity	Code	Description	Project	File	Line	Suppression State
Error		fatal error LNK1120: 11 unresolved externals		Debug\Console1.exe		
Error		error LNK2019: unresolved external symbol _dfti_error_message_external referenced in function _DFTI_EXAMPLE_STATUS_PRINT		dfti_example_status_print.obj		
Error		error LNK2019: unresolved external symbol _dfti_free_descriptor_external referenced in function _MAIN__		real_1d_ccs_double_ex6.obj		
Error		error LNK2019: unresolved external symbol _dfti_set_value_dblval referenced in function _MAIN__		real_1d_ccs_double_ex6.obj		
Error		error LNK2019: unresolved external symbol _dfti_set_value_intval referenced in function _MAIN__		real_1d_ccs_double_ex6.obj		
Error		error LNK2019: unresolved external symbol _dfti_commit_descriptor_external referenced in function _MAIN__		real_1d_ccs_double_ex6.obj		
Error		error LNK2019: unresolved external symbol _dfti_error_class_external referenced in function _MAIN__		real_1d_ccs_double_ex6.obj		
Error		error LNK2019: unresolved external symbol _dfti_set_value_intvec referenced in function _MAIN__		real_1d_ccs_double_ex6.obj		
Error		error LNK2019: unresolved external symbol _DCOPY referenced in function _MAIN__		real_1d_ccs_double_ex6.obj		
Error		error LNK2019: unresolved external symbol _dfti_compute_backward_dd referenced in function _MAIN__		real_1d_ccs_double_ex6.obj		
Error		error LNK2019: unresolved external symbol _dfti_compute_forward_dd referenced in function _MAIN__		real_1d_ccs_double_ex6.obj		
Error		error LNK2019: unresolved external symbol _dfti_create_descriptor_1d referenced in function _MAIN__		real_1d_ccs_double_ex6.obj		

 

More information for diagnose:

Compiler command in old project:

/nologo /O2 /I"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\mkl\lib\ia32_win" /module:"Release\\" /object:"Release\\" /Fd"Release\vc140.pdb" /libs:static /threads /c

Command line in new project:

/nologo /O2 /I"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\mkl\lib\ia32_win" /module:"Release\\" /object:"Release\\" /Fd"Release\vc140.pdb" /libs:static /threads /c

Command line for linker in old project:

/OUT:"Release\DFT_RtoCCS.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\mkl\lib\ia32_win" /MANIFEST /MANIFESTFILE:"Release\DFT_RtoCCS.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /IMPLIB:"C:\Users\***** ***\Desktop\DFT_RtoCCS\Release\DFT_RtoCCS.lib" mkl_intel_c_dll.lib mkl_core_dll.lib mkl_intel_thread_dll.lib

Command line for linker in new project:

/OUT:"Release\Console1.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\mkl\lib\ia32_win" /MANIFEST /MANIFESTFILE:"Release\Console1.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /IMPLIB:"C:\Users\***** ***\Desktop\New folder\Console1\Release\Console1.lib" mkl_intel_c_dll.lib mkl_core_dll.lib mkl_intel_thread_dll.lib

There are barely any difference. The old project works, the new one just cannot find those functions in library and failed. I attached the compressed project

0 Kudos
2 Replies
mecej4
Honored Contributor III
312 Views

You have a superfluous file, "Source1.f90", in your project directory. You cannot have two main programs in a project, so remove it. Your project is not configured to use MKL. See https://software.intel.com/en-us/node/528341 .

An alternative is to make a copy of the old project that is working, and modifying it by replacing the old directory names and file names with appropriate new names.

0 Kudos
Yuwei_Z_
Beginner
312 Views

mecej4 wrote:

You have a superfluous file, "Source1.f90", in your project directory. You cannot have two main programs in a project, so remove it. Your project is not configured to use MKL. See https://software.intel.com/en-us/node/528341 .

An alternative is to make a copy of the old project that is working, and modifying it by replacing the old directory names and file names with appropriate new names.

Thank you! No, the file is not in the project, it is removed from the project.

I somehow figured out that my MSVS15 or my Intel Parallel studio XE is broken. So I reinstalled both of them and now the exact same project linked correctly and compiled perfectly. I was so bothered yesterday that I was even considering reinstall my windows 10 pro.

LOL, The last resort to fix program things is always reinstall.

0 Kudos
Reply