I have been trying to use Intel MKL
in a mex file in MATLAB. I used the following switches to be able to compile and link, but no success.
>> mex -v myMEX.cpp -I"C:\Program Files (x86)\Intel\ComposerXE-2011\mkl\include\" -L"C:\Program Files (x86)\Intel\ComposerXE-2011\mkl\lib\intel64" -l mkl_intel_lp64.lib -l mkl_core.lib -l mkl_sequential.lib
I get the following error
-> Options file = C:\Users\Ahd\AppData\Roaming\MathWorks\MATLAB\R2012b\mexopts.bat
MATLAB = C:\Program Files\MATLAB\R2012b
-> COMPILER = cl
-> Compiler flags:
COMPFLAGS = /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
OPTIMFLAGS = /O2 /Oy- /DNDEBUG
DEBUGFLAGS = /Z7
arguments = -I"C:\Program Files (x86)\Intel\ComposerXE-2011\mkl\include\"
Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"C:\Users\Ahd\AppData\Local\Temp\mex__fKb2b\templib.x" /MAP:"myMEX.mexw64.map"
LINKDEBUGFLAGS = /DEBUG /PDB:"myMEX.mexw64.pdb"
LINKFLAGSPOST =
Name directive = /out:"myMEX.mexw64"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
--> cl -I"C:\Program Files (x86)\Intel\ComposerXE-2011\mkl\include\" /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /FoC:\Users\Ahd\AppData\Local\Temp\mex__fKb2b\myMEX.obj -I"C:\Program Files\MATLAB\R2012b\extern\include" -I"C:\Program Files\MATLAB\R2012b\simulink\include" /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 myMEX.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9024 : unrecognized source file type 'Files\MATLAB\R2012b\extern\include -IC:\Program', object file assumed
DNDEBUG -DMX_COMPAT_32 myMEX.cpp
c1xx : fatal error C1083: Cannot open source file: 'Files\MATLAB\R2012b\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 myMEX.cpp': No such file or directory
C:\PROGRA~1\MATLAB\R2012B\BIN\MEX.PL: Error: Compile of 'myMEX.cpp' failed.
Error using mex (line 206)
Unable to complete successfully.
Could someone please help me?
Check mexopts.bat file. Looks like MATLAB variable is not defined properly, or some path in INCLUDE statement. Consider putting quotes around paths which contain spaces.