Matlab plug-in installation error

Hello. I’ve downloaded Matlab CUDA plug-in 1.1 and can’t get past the CUDA source compilation:

>> nvmex -f nvmexopts.bat Szeta.cu -IC:\cuda\include -LC:\cuda\lib -lcufft -lcudart

nvcc fatal   : nvcc cannot find a supported cl version. Only MSVC 8.0 and MSVC 9.0 are supported 

C:\PROGRA~1\MATLAB\R2009B\BIN\NVMEX.PL: Error: Compile of 'Szeta.cu' failed. 

??? Error using ==> nvmex at 206

Unable to complete successfully.

When I run it in verbose mode:

>> nvmex -v -f nvmexopts.bat Szeta.cu -IC:\cuda\include -LC:\cuda\lib -lcufft -lcudart

 This is mex, Copyright 1984-2005 The MathWorks, Inc. 

-> Options file specified on command line 

---------------------------------------------------------------- 

->	Options file		   = nvmexopts.bat 

	  MATLAB				 = C:\PROGRA~1\MATLAB\R2009b 

->	COMPILER			   = nvcc 

->	Compiler flags: 

		 COMPFLAGS		   = -c -D_WCHAR_T_DEFINED -Xcompiler "/c /Zp8 /GR /W3 /EHsc- /Zc:wchar_t- /DMATLAB_MEX_FILE /nologo" 

		 OPTIMFLAGS		  = -D_WCHAR_T_DEFINED -Xcompiler "/MD /O2 /Oy- /DNDEBUG" 

		 DEBUGFLAGS		  = -D_WCHAR_T_DEFINED -Xcompiler "/MD /Zi /Fd"Szeta.mexw32.pdb" 

		 arguments		   =  -IC:\cuda\include 

		 Name switch		 = -o 

->	Pre-linking commands   =  

->	LINKER				 = link 

->	Link directives: 

		 LINKFLAGS		   = /dll /export:mexFunction /MAP /LIBPATH:"C:\PROGRA~1\MATLAB\R2009b\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib /implib:templib.x /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 

		 LINKDEBUGFLAGS	  = /DEBUG /PDB:"Szeta.mexw32.pdb" 

		 LINKFLAGSPOST	   =  

		 Name directive	  = /out:"Szeta.mexw32" 

		 File link directive =  

		 Lib. link directive =  

		 Rsp file indicator  = @ 

->	Resource Compiler	  = rc /fo "mexversion.res" 

->	Resource Linker		=  

---------------------------------------------------------------- 

--> nvcc  -IC:\cuda\include -c -D_WCHAR_T_DEFINED -Xcompiler "/c /Zp8 /GR /W3 /EHsc- /Zc:wchar_t- /DMATLAB_MEX_FILE /nologo" -o Szeta.obj -IC:\PROGRA~1\MATLAB\R2009b\extern\include -IC:\PROGRA~1\MATLAB\R2009b\simulink\include -D_WCHAR_T_DEFINED -Xcompiler "/MD /O2 /Oy- /DNDEBUG" -DMX_COMPAT_32 Szeta.cu 

nvcc fatal   : nvcc cannot find a supported cl version. Only MSVC 8.0 and MSVC 9.0 are supported 

C:\PROGRA~1\MATLAB\R2009B\BIN\NVMEX.PL: Error: Compile of 'Szeta.cu' failed. 

??? Error using ==> nvmex at 206

Unable to complete successfully.

I have alread modified “nvmexopts.bat”:

set VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 2008

to

set VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 9.0

It surely must be some incorrect path in nvcc, because I already got cl.exe, version 9.0.

Thanks.

Okay, now “nvmexopts.bat” got modified again:

set COMPFLAGS=-c -D_WCHAR_T_DEFINED -Xcompiler "/c /Zp8 /GR /W3 /EHsc- /Zc:wchar_t- /DMATLAB_MEX_FILE /nologo"

to

set COMPFLAGS=-c -ccbin "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin" -D_WCHAR_T_DEFINED -Xcompiler "/c /Zp8 /GR /W3 /EHsc- /Zc:wchar_t- /DMATLAB_MEX_FILE /nologo"

But now a buttload of errors popped up:

>> nvmex -f nvmexopts.bat Szeta.cu -IC:\cuda\include -LC:\cuda\lib -lcufft -lcudart

Szeta.cu 

tmpxft_000009a0_00000000-3_Szeta.cudafe1.gpu 

tmpxft_000009a0_00000000-8_Szeta.cudafe2.gpu 

tmpxft_000009a0_00000000-3_Szeta.cudafe1.cpp 

cl : Command line warning D9025 : overriding '/EHc-' with '/EHc' 

tmpxft_000009a0_00000000-12_Szeta.ii 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(235) : error C2065: '_Buffer' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(235) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(235) : error C2988: unrecognizable template declaration/definition 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(235) : error C2059: syntax error : 'const' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(237) : error C2143: syntax error : missing ';' before '{' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(237) : error C2447: '{' : missing function header (old-style formal list?) 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(239) : error C2065: '_Buffer' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(239) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(239) : error C2988: unrecognizable template declaration/definition 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(239) : error C2059: syntax error : 'const' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(241) : error C2143: syntax error : missing ';' before '{' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(241) : error C2447: '{' : missing function header (old-style formal list?) 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(245) : error C2065: '_Buffer' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(245) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(245) : warning C4229: anachronism used : modifiers on data are ignored 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(245) : error C2433: '_wstrdate_s' : 'inline' not permitted on data declarations 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(245) : error C2998: 'errno_t _wstrdate_s' : cannot be a template definition 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(249) : error C2065: '_Buffer' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(249) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(249) : warning C4229: anachronism used : modifiers on data are ignored 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(249) : error C2433: '_wstrtime_s' : 'inline' not permitted on data declarations 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(249) : error C2998: 'errno_t _wstrtime_s' : cannot be a template definition 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(254) : error C2065: '_Buffer' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(254) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(254) : error C2988: unrecognizable template declaration/definition 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(254) : error C2059: syntax error : 'const' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\wtime.inl(46) : error C2143: syntax error : missing ';' before '{' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\wtime.inl(46) : error C2447: '{' : missing function header (old-style formal list?) 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\wtime.inl(56) : error C3861: '_wctime64_s': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(195) : error C2664: 'memchr' : cannot convert parameter 1 from 'const void *' to 'void *' 

		Conversion loses qualifiers 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(244) : error C2065: '_Dest' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(244) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(244) : error C2988: unrecognizable template declaration/definition 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(244) : error C2059: syntax error : 'const' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(245) : error C2143: syntax error : missing ';' before '{' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(245) : error C2447: '{' : missing function header (old-style formal list?) 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(251) : error C2065: '_Dest' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(251) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(251) : error C2988: unrecognizable template declaration/definition 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(251) : error C2059: syntax error : 'const' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(252) : error C2143: syntax error : missing ';' before '{' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(252) : error C2447: '{' : missing function header (old-style formal list?) 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(259) : error C3861: 'wcsnlen': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(265) : error C2065: '_Dest' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(265) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(265) : error C2988: unrecognizable template declaration/definition 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(265) : error C2059: syntax error : 'const' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(268) : error C2143: syntax error : missing ';' before '{' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(268) : error C2447: '{' : missing function header (old-style formal list?) 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(274) : error C2065: '_Dest' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(274) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(274) : error C2988: unrecognizable template declaration/definition 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(274) : error C2059: syntax error : 'const' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(275) : error C2143: syntax error : missing ';' before '{' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(275) : error C2447: '{' : missing function header (old-style formal list?) 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(286) : error C2065: '_Buffer' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(286) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(286) : error C2062: type 'int' unexpected 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(287) : error C2143: syntax error : missing ';' before '{' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(287) : error C2447: '{' : missing function header (old-style formal list?) 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(289) : error C2065: '_Buffer' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(289) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(289) : error C2988: unrecognizable template declaration/definition 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(289) : error C2059: syntax error : 'const' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(291) : error C2143: syntax error : missing ';' before '{' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(291) : error C2447: '{' : missing function header (old-style formal list?) 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(296) : error C2065: '_Dst' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(296) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(296) : error C2065: 'wchar_t' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(296) : error C2146: syntax error : missing ')' before identifier '_Val' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(296) : warning C4229: anachronism used : modifiers on data are ignored 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(296) : error C2433: '_wcsnset_s' : 'inline' not permitted on data declarations 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(296) : error C2059: syntax error : ')' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(297) : error C2143: syntax error : missing ';' before '{' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(297) : error C2447: '{' : missing function header (old-style formal list?) 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(300) : error C2065: '_Str' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(300) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(300) : error C2065: 'wchar_t' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(300) : error C2146: syntax error : missing ')' before identifier '_Val' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(300) : warning C4229: anachronism used : modifiers on data are ignored 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(300) : error C2433: '_wcsset_s' : 'inline' not permitted on data declarations 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(300) : error C2059: syntax error : ')' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(301) : error C2143: syntax error : missing ';' before '{' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(301) : error C2447: '{' : missing function header (old-style formal list?) 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(304) : error C2065: '_String' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(304) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(304) : warning C4229: anachronism used : modifiers on data are ignored 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(304) : error C2433: '_wcslwr_s' : 'inline' not permitted on data declarations 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(304) : error C2998: 'errno_t _wcslwr_s' : cannot be a template definition 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(307) : error C2065: '_String' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(307) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(307) : error C2275: '_locale_t' : illegal use of this type as an expression 

		C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\crtdefs.h(2035) : see declaration of '_locale_t' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(307) : error C2146: syntax error : missing ')' before identifier '_Locale' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(307) : warning C4229: anachronism used : modifiers on data are ignored 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(307) : error C2433: '_wcslwr_s_l' : 'inline' not permitted on data declarations 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(307) : error C2059: syntax error : ')' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(308) : error C2143: syntax error : missing ';' before '{' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(308) : error C2447: '{' : missing function header (old-style formal list?) 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(310) : error C2065: '_String' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(310) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(310) : warning C4229: anachronism used : modifiers on data are ignored 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(310) : error C2433: '_wcsupr_s' : 'inline' not permitted on data declarations 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(310) : error C2998: 'errno_t _wcsupr_s' : cannot be a template definition 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(313) : error C2065: '_String' : undeclared identifier 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(313) : error C3861: 'wchar_t': identifier not found 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(313) : error C2275: '_locale_t' : illegal use of this type as an expression 

		C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\crtdefs.h(2035) : see declaration of '_locale_t' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(313) : error C2146: syntax error : missing ')' before identifier '_Locale' 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(313) : warning C4229: anachronism used : modifiers on data are ignored 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(313) : error C2433: '_wcsupr_s_l' : 'inline' not permitted on data declarations 

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(313) : fatal error C1003: error count exceeds 100; stopping compilation 

C:\PROGRA~1\MATLAB\R2009B\BIN\NVMEX.PL: Error: Compile of 'Szeta.cu' failed. 

??? Error using ==> nvmex at 206

Unable to complete successfully.

I had a similar problem but I found it was because I had the old nvmexopts.bat in my working directory. Using the nvmexopts.bat in http://forums.nvidia.com/index.php?showtopic=66961 (renamed to nvmexopts.bat) fixed this error on my system.