Search code examples
c++matlabmexlnk2019intel-ipp

Creating a mex file linked to Intel's ipp library


I'm trying to improve my matlab code performance by replacing a part of it with a a c++ program, and for that I'm using intel's ipp library. The problem occurs when trying to compile and link the program. I get the added error.

I'm using Matlab2016a 64bit, Windows 10 64bit and Building with 'Microsoft Visual C++ 2015 Professional'.

Thank you!

Nadav

mex nesta.cpp -L'C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.2.187\windows\ipp\lib\intel64_win' -I'C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.2.187\windows\ipp\include' Building with 'Microsoft Visual C++ 2015 Professional'. Error using mex Creating library nesta.lib and object nesta.exp nesta.obj : error LNK2019: unresolved external symbol ippsAdd_32fc_I referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsAdd_32fc referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsMulC_32fc referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsMul_32fc referenced in function "void __cdecl perform_L1_constraint(struct Ipp32fc *,float,struct Ipp32fc *,float *)" (?perform_L1_constraint@@YAXPEAUIpp32fc@@M0PEAM@Z) nesta.obj : error LNK2019: unresolved external symbol ippsSub_32fc_I referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsSub_32fc referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsDiv_32fc_I referenced in function "void __cdecl perform_L1_constraint(struct Ipp32fc *,float,struct Ipp32fc *,float *)" (?perform_L1_constraint@@YAXPEAUIpp32fc@@M0PEAM@Z) nesta.obj : error LNK2019: unresolved external symbol ippsConj_32fc referenced in function "void __cdecl perform_L1_constraint(struct Ipp32fc *,float,struct Ipp32fc *,float *)" (?perform_L1_constraint@@YAXPEAUIpp32fc@@M0PEAM@Z) nesta.obj : error LNK2019: unresolved external symbol ippsSum_32fc referenced in function "void __cdecl perform_L1_constraint(struct Ipp32fc *,float,struct Ipp32fc *,float *)" (?perform_L1_constraint@@YAXPEAUIpp32fc@@M0PEAM@Z) nesta.obj : error LNK2019: unresolved external symbol ippsMax_32f referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsNorm_L2_32fc64f referenced in function "void __cdecl perform_L1_constraint(struct Ipp32fc *,float,struct Ipp32fc *,float *)" (?perform_L1_constraint@@YAXPEAUIpp32fc@@M0PEAM@Z) nesta.obj : error LNK2019: unresolved external symbol ippsDFTInit_C_32fc referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsDFTFwd_CToC_32fc referenced in function "void __cdecl A(struct Ipp32fc *,struct Ipp32fc *,struct DFTSpec_C_32fc *)" (?A@@YAXPEAUIpp32fc@@0PEAUDFTSpec_C_32fc@@@Z) nesta.obj : error LNK2019: unresolved external symbol ippsDFTInv_CToC_32fc referenced in function "void __cdecl At(struct Ipp32fc *,struct Ipp32fc *,struct DFTSpec_C_32fc *)" (?At@@YAXPEAUIpp32fc@@0PEAUDFTSpec_C_32fc@@@Z) nesta.obj : error LNK2019: unresolved external symbol ippsAbs_32fc_A11 referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.mexw64 : fatal error LNK1120: 15 unresolved externals`enter code here


Solution

  • looks like i solved it. the -l flag didn't work as I expected.

    this command worked:

    mex 'C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.2.187\windows\ipp\lib\intel64_win\*.lib' nesta.cpp -I'C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.2.187\windows\ipp\include'