2013-02-13 57 views
0

我一直試圖在MATLAB的mex文件中使用Intel MKL。我用下面的開關來編譯和鏈接,但沒有成功。在MEX中使用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

檢查mexopts.bat文件。 看起來像MATLAB變量沒有正確定義,或者在INCLUDE語句中有一些路徑。考慮將引號放在包含空格的路徑的周圍。