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

Intel Composer XE2013 - problems with including library

Marek_C_
Beginner
493 Views

Hello everyone,

I am currently working on certain project, where i should use MKL library (at this moment fft procedure). I am beginner in programming with C and using Visual Studio 2010, so I maybe not understand everything and my knowledge is still in process of development.

According to intel's website, process of linking the library should be proceeded as below:

http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-compiling-and-linking-with-microsoft-visual-cc

I don't have intel's compiler, so I cannot add the library automatically.

I have added the directories for library and include in Solution Explorer > Properties (VC++ Directories, C/C++ General, Linker General) and additional dependencies (for both Debug and Release), but I still get error LNK2019: unresolved external symbol.

Short part of my project looks like this:

#include "mkl_dfti.h"
#include "mkl.h"

int fun1(...)
{   

DFTI_DESCRIPTOR_HANDLE fft_handle;
MKL_LONG status;

status = DftiCreateDescriptor(&fft_handle, DFTI_DOUBLE, DFTI_REAL, 1, fftpoint);
status = DftiCommitDescriptor(fft_handle);
status = DftiSetValue(fft_handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
status = DftiComputeForward(fft_handle, rawWin.pVector, rawFft_temp.pVector );
status = DftiFreeDescriptor(&fft_handle);

return 0;

}

Where rawWin.pVector and rawFft_temp.pVector are input and output. (I skipped some part of the program for certain reason, but I can assure you that until that point of calculating fft, everything is working perfect).

I try to skip this part, by using other library from Matlab to import .mat file data and move on with my project at least a little bit. But I get the same type of error when including Matlab's library, according to their website. So I guess, I must do something wrong when linking the libs.

Here is the output from VS:

1>------ Build started: Project: C_transcript_updated, Configuration: Debug Win32 ------
1>Build started 12/02/2013 17:29:37.
1>InitializeBuildStatus:
1>  Touching "Debug\C_transcript_updated.unsuccessfulbuild".
1>ClCompile:
1>  audio.c
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>Link:
1>  
1>  Searching libraries
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_core.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_intel_lp64.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_rt.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_intel_thread.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_sequential.lib:
1>      Searching C:\Program Files\MATLAB\R2011b\extern\lib\win64\microsoft\libmat.lib:
1>      Searching C:\Program Files\MATLAB\R2011b\extern\lib\win64\microsoft\libmx.lib:
1>      Searching C:\Program Files\MATLAB\R2011b\extern\lib\win64\microsoft\libmwlapack.lib:
1>      Searching C:\Program Files\MATLAB\R2011b\extern\lib\win64\microsoft\libmex.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\kernel32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\user32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\gdi32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\winspool.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\comdlg32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\advapi32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\shell32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\ole32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\oleaut32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\uuid.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\odbc32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\odbccp32.lib:
1>      Searching c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\MSVCRTD.lib:
1>      Searching c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\OLDNAMES.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_core.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_intel_lp64.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_rt.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_intel_thread.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_sequential.lib:
1>      Searching C:\Program Files\MATLAB\R2011b\extern\lib\win64\microsoft\libmat.lib:
1>      Searching C:\Program Files\MATLAB\R2011b\extern\lib\win64\microsoft\libmx.lib:
1>      Searching C:\Program Files\MATLAB\R2011b\extern\lib\win64\microsoft\libmwlapack.lib:
1>      Searching C:\Program Files\MATLAB\R2011b\extern\lib\win64\microsoft\libmex.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\kernel32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\user32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\gdi32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\winspool.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\comdlg32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\advapi32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\shell32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\ole32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\oleaut32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\uuid.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\odbc32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\odbccp32.lib:
1>      Searching c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\MSVCRTD.lib:
1>      Searching c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\OLDNAMES.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_core.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_intel_lp64.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_rt.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_intel_thread.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_sequential.lib:
1>      Searching C:\Program Files\MATLAB\R2011b\extern\lib\win64\microsoft\libmat.lib:
1>      Searching C:\Program Files\MATLAB\R2011b\extern\lib\win64\microsoft\libmx.lib:
1>      Searching C:\Program Files\MATLAB\R2011b\extern\lib\win64\microsoft\libmwlapack.lib:
1>      Searching C:\Program Files\MATLAB\R2011b\extern\lib\win64\microsoft\libmex.lib:
1>  
1>  Finished searching libraries
1>audio.obj : error LNK2019: unresolved external symbol _DftiFreeDescriptor referenced in function _mkFbo
1>audio.obj : error LNK2019: unresolved external symbol _DftiComputeForward referenced in function _mkFbo
1>audio.obj : error LNK2019: unresolved external symbol _DftiSetValue referenced in function _mkFbo
1>audio.obj : error LNK2019: unresolved external symbol _DftiCommitDescriptor referenced in function _mkFbo
1>audio.obj : error LNK2019: unresolved external symbol _DftiCreateDescriptor_d_1d referenced in function _mkFbo
1>C:\Users\xxxx.... : fatal error LNK1120: 5 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.44
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========

I will be more than grateful for any help, anyone can provide me, because i cannot move on with my project, and soon I will have to use other MKL's functions, like matrix operations.

Best regards,

Marek

0 Kudos
10 Replies
Gennady_F_Intel
Moderator
493 Views

Marek,

When you choose "use MKL button", then instead on "No", please choose for example "Sequential" or "Parallel"

--Gennady

0 Kudos
Marek_C_
Beginner
493 Views

Hello,

Thank you for your reply, but I do not have Intel compiler options, where I can turn on MKL, that is why I try to link it manualy.

Best regards,

Marek

0 Kudos
SergeyKostrov
Valued Contributor II
493 Views
>>...I do not have Intel compiler options, where I can turn on MKL... - In Visual Studio 2010 select your project - Mouse right button - Select Intel C++ Composer XE 20xx - Click on Select Build Components menu item Note: I assumed that Intel C++ compiler is integrated with your Visual Studio 2010.
0 Kudos
Gennady_F_Intel
Moderator
493 Views

in the case if Sergey's advice will not help - it would be surprise but then you  please try to manually add the following libraries "mkl_intel_lp64.lib mkl_sequential.lib  mkl_core.lib" to the Linker/Input/Additional Dependencies. 

0 Kudos
Marek_C_
Beginner
493 Views

Thank you both for your advises.

@Sergey Kostrov

I don't have Intel C++ Composer XE in the menu, I upload the screenshot.

@Gennady Fedorov

Those libs are already added to additional dependencies, both for Debug and Release.

Best regards,

Marek

0 Kudos
Zhang_Z_Intel
Employee
493 Views

I had a look at your error messages. Why was "mkl_rt.lib" on the search path? If you have it in the Additional Dependencies then please remove. You should only add "mkl_intel_lp64.lib;mkl_sequential.lib;mkl_core.lib" (in this order) to Additional Dependencies.

Marek C. wrote:

Thank you both for your advises.

@Sergey Kostrov

I don't have Intel C++ Composer XE in the menu, I upload the screenshot.

@Gennady Fedorov

Those libs are already added to additional dependencies, both for Debug and Release.

Best regards,

Marek

0 Kudos
Marek_C_
Beginner
493 Views

Thanks,

I added this just in case, because I added many libs to see the result. I did like you suggested but still no effect. Here is the result:

1>------ Build started: Project: C_transcript_updated, Configuration: Debug Win32 ------
1>Build started 13/02/2013 10:02:53.
1>InitializeBuildStatus:
1>  Touching "Debug\C_transcript_updated.unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>Link:
1>  
1>  Searching libraries
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_intel_lp64.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_sequential.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_core.lib:
1>      Searching c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\MSVCRTD.lib:
1>      Searching c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\OLDNAMES.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\kernel32.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_intel_lp64.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_sequential.lib:
1>      Searching C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\intel64\mkl_core.lib:
1>      Searching c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\MSVCRTD.lib:
1>      Searching c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\OLDNAMES.lib:
1>  
1>  Finished searching libraries
1>audio.obj : error LNK2019: unresolved external symbol _DftiFreeDescriptor referenced in function _mkFbo
1>audio.obj : error LNK2019: unresolved external symbol _DftiComputeForward referenced in function _mkFbo
1>audio.obj : error LNK2019: unresolved external symbol _DftiSetValue referenced in function _mkFbo
1>audio.obj : error LNK2019: unresolved external symbol _DftiCommitDescriptor referenced in function _mkFbo
1>audio.obj : error LNK2019: unresolved external symbol _DftiCreateDescriptor_d_1d referenced in function _mkFbo
1>C:\Users\xxxx : fatal error LNK1120: 5 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.47
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I seriously don't know where I made a mistake, I tried different configurations, Paralel Studio looks like it has compiler installed, according to setup app, where I looked at modify option, but I do not see it in Visual Studio. Only option that comes to my mind for now is to reinstall the MKL package and maybe installing the older version of VS, but since I cannot do that by myself I will have to wait for permission from my superiors, who knows when will that happen and it is like more than a week of no progress in my project, so I feel little disappointed.

Best regards,

Marek

0 Kudos
Gennady_F_Intel
Moderator
493 Views

arek, please see the VS2010 project with Lapack routing attached into this thread, may be this project will help you to see how to build the simplest case.

 

0 Kudos
Marek_C_
Beginner
493 Views

Thanks,

I solved the problem. Proper settings was to set the compiler to x64, which I did before but I also checked 32bit version just in case. The key to solve this problem was to add the libiomp5md.lib, which I have not taken under consideration.

Result of FFT is useless (some random very big numbers) - compared to Matlab in which I am double checking my algorithm. At least I can move forward and now solve that problem.

BIG thanks!

Best regards,

Marek

0 Kudos
SergeyKostrov
Valued Contributor II
493 Views
Thanks for the update. It is interesting that adding the libiomp5md.lib library helped to resolve linking problems. This is Intel's OpenMP library and it doesn't have any references to MKL's _DftiXxx functions.
0 Kudos
Reply