I'm using Intel MKL to calculate some complex to real DFT transforms and their inverse. In my project I also use `std::exp` math function with float data type. The issue is, that for some reason the `ldexpf` function is both exported from the Intel math library and Intel MKL and the linking step fails:
libmmd.lib(libmmd.dll) : : error LNK2005: ldexpf already defined in mkl_intel_ilp64_dll.lib(dfticreatedescriptor_s_md.obj)
This applies to the static library builds as well:
libmmd.lib(libmmd.dll) : : error LNK2005: ldexpf already defined in mkl_intel_ilp64.lib(dfticreatedescriptor_s_md.obj)
The important change that triggered this behavior can be found in `math.h`, Intel C++ 2019.03 version, starting at line 89:
/* _ldexpf already defined libcpmt.lib, may cause conflict */ /* temporarily allow inline implementation in MS header file */ //# define ldexpf __MS_ldexpf
Intel C++ Compiler 2019.04 and later:
# define ldexpf __MS_ldexpf
As a workaround, one may a) comment out the above mentioned line again in the `math.h` b) pass `/FORCE:MULTIPLE` to the linker.
I did not make a minimal example since the error seems to be straightforward and you dealt with similar issues before: https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/805616 . I usually link "manually" due to the use of different compilers and static linking support (with link line confirmed to be identical to the one generated with MKL link line advisor for Windows, ILP64 API, OpenMP threading) but I get the same result by simply using `-DMKL_ILP64 /Qmkl:parallel`.
Intel C++ Compiler Version 184.108.40.206 (but you can use any version starting from 2019.04)
Visual Studio 2017 Version 15.9.15 (VS 2019 tested a while ago with the same outcome), the bug doesn't affect GNU/Linux builds
Intel MKL Version 2020 (tested several versions between 2019 Update 3 and 2020, all affected)