在MEX中使用MKL标头/库文件

时间:2013-02-13 20:14:44

标签: matlab intel-mkl

我一直在尝试在MATLAB的mex文件中使用Intel MKL。我使用以下开关来编译和链接,但没有成功。

>> 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

我收到以下错误

->    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.

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

检查mexopts.bat文件。 看起来没有正确定义MATLAB变量,或者INCLUDE语句中的某个路径。考虑在包含空格的路径周围加上引号。

相关问题