VISTA64, Matlab 2009a, VS2005 -> Upgrade to VS 2008?

I currently can compile the sample code in MATLAB with VS2005 as the compiler.

I installed VS2008, verified it worked separately, and updated the nvmexopts.bat file to call VS2008. However, when I try to compile using the nvmex command in MATLAB, it produces the following linker error:

nvmex -f nvmexopts.bat -IC:\cuda\include -LC:\cuda\lib -lcufft -lcudart
abdelali target arch: win64
Microsoft ® Incremental Linker Version 9.00.21022.08
Copyright © Microsoft Corporation. All rights reserved.

LINK : fatal error LNK1181: cannot open input file ‘kernel32.lib’

C:\PROGRA~1\MATLAB\R2009A\BIN\NVMEX.PL: Error: Link of ‘Szeta.mexw64’ failed.

??? Error using ==> nvmex at 206
Unable to complete successfully.

Any suggestions?

I have attached the and nvmexopts.bat files I am using. The set with _9 in the name is the one I am trying to use with VS2008. The other set works great for VS2005 and my setup in case anyone else is looking for these files.


Vista Business x64
Matlab 2009a x64 (CUDA plug in 1.1)
Visual Studio 2008 (VS Vizard 2.0 used for setup)
CUDA version 2.2
TESLA c1060
nvmexopts.bat.txt (3.05 KB) (106 KB)
nvmexopts_9.bat.txt (3.05 KB)

Hi zimagold,

I had the same problem(s) when I tried to compile the sample codes using nvmex. After some digging, I found out that VS2008 installed a few things in different locations. For example, (for me at least) %VCINSTALLDIR%\PlatformSDK\lib\AMD64 and %VSINSTALLDIR%\SDK\v2.0\lib\AMD64 are either empty or nonexistent.

Usually the libraries can be found in C:\Program Files\Microsoft SDKs\Windows\v6.0A. So if you add this path in the nvmexopts.bat file and replace all the %VCINSTALLDIR%\PlatformSDK with that path, it should work for you.

I have attached both and nvmexopts.bat files that I use to compile the sample correctly.


Windows XP Pro x64

Matlab 2009a x64 (CUDA plug in 1.1)

Visual Studio 2008

CUDA version 2.2

Geforce 8800 GT

nvmexopts.bat.txt (3.06 KB) (106 KB)

that’s it…you just helped me solve my problem.
thanks a lot!!! :thumbup:

I don’t know how you guys got this to run. On my computer it crashes complaining about $ARCH=UNKNOWN. I looked at your script and the original one too, both have the same bug on line 157
($main::matlabroot = main::cmd_name) =~ s%\\bin\\;
This needs to be adapted to
($main::matlabroot = main::cmd_name) =~ s%\\bin\\;
otherwise the grep doesn’t work, matlabroot is wrong, the script doesn’t find the matlab.exe downstream and can’t deduct the architecture.
Attached is the corrected version.

…nother question - on a win64 with the matlab.exe in the win64 folder, could I still compile for win32? How?

Hi…because this post is bit older now, so if anyone has still any issue regarding running Matlab plugin, u may let me know…I have Windows7 installed on my machine, with matlab 2008a and CUDA toolkit 2.2(2.3 also ave no issues)…I have really worked on batch and pearl files to make them work for me and the giving matlab example is successfully working now…i needed to update the batch file.peral file is the one Edited by Adelalizahiand its working fine, i am grateful to that gentle man…for 64bit computing there r also some batch files needed to be copied to make VS2008 working.

waiting for ur comments.

I have solve this problem.

It seems that some directory in the file “nvmexopts.bat” have been not correct.

My system:

Win7 64bit

Matlab 2009b


CUDA 2.2

My VS2008 has installed in K:,so does my system.

You should change to “C:” in this file.
nvmexopts.bat.txt (3.05 KB)