Working: nvmex,vista64,VS2008 express,cuda 2.2

The following configuration is working for vista 64-bit, VS2008 express, nvmex, and matlab 2008b.

Visual Studio 2008 express and Windows SDK (v6.1) are installed at default locations. The SDK installs the 64-bit compilers etc. This seems to be the default on 64-bit systems.

This will generate mexw64 files.

The required files are (106 KB)

nvmexopts_9.bat.txt (4.38 KB)

vcvarsamd64.bat.txt (954 Bytes) and vcvarsamd64.bat are files others have contributed.
nvmexopts_9.bat is a modified file of a contributed file.

vcvarsamd64.bat must go in:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat

or you will get the error:

nvcc fatal : Visual Studio configuration file ‘(null)’ could not be found…

The modified nvmexopts_9.bat gives paths only to the 64-bit libraries. If the 32-bit libraries are found first on the the LIB path, you will get unresolved symbol errors.

:rolleyes: I don’t know how to thank you !
I had the good and nvmexopts.bat but not the vcvarsamd64.bat and had always the error : nvcc fatal : Visual Studio configuration file ‘(null)’ could not be found …
Thanks :thumbup:

Nice. Thanks. But I hope you can help me with one thing. When I try to compile it with nvmex, I get this error:

nvmex -f nvmexopts.bat -lcufft
abdelali target arch: win64
Warning: cufft specified with -l option not found on -L path
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\R2008A\BIN\NVMEX.PL: Error: Link of ‘cudaKernel.mexw64’ failed.

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

I realy hope you can help me with this problem. Searched after a solution on google, but found nothing.

Help! I could not download those attachments from the topic. If any one could download them, could you please email them to me? Thx. I use VS 2008 Professional, MAtlab 2009a and CUDA 2.2 on Windows 7 64-bit Quadro FX 770m and Quadro FX 1700.

Windows Xp x64, Matlab 2009b (“a” also), VS 2008 SP1, Windows SDK v.6.1, CUDA 2.2 give the following:

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

abdelali target arch: win64
c:\cuda\include\texture_fetch_functions.h(71): error: expected a file name

c:\cuda\include\texture_fetch_functions.h(73): error: expected a file name

c:\cuda\include\texture_fetch_functions.h(75): error: expected a file name

c:\cuda\include\texture_fetch_functions.h(77): error: expected a file name

c:\cuda\include\texture_fetch_functions.h(79): error: expected a file name

(a lot of errors)

Error limit reached.
100 errors detected in the compilation of “C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00000d64_00000000-7_alg.cpp2.i”.
Compilation terminated.

C:\PROGRA~1\MATLAB\R2009B\BIN\NVMEX.PL: Error: Compile of ‘’ failed.

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

I have also tried to use nvmex and nvmexopts posted here: (#13)
Results are the same.
Does anybody have a solution or maybe prompts?

Finally! Solution of my problem is all pathes must contain ONLY english letters (including path to your matlab plugin folder)

The paths are already only in english. Could you be more precise as to what solved your problem? Am getting the same problem and my configuration is: Win7 64bit, Matlab R2009a, VS2008

@klidke: Am really thankful it actually worked out!

Likewise! You rock mate. Got it working on Win7 64, VS2008 9.0 Express with 64bit SDK 7.0 after a mere 4 hours (was bloody using C:\CUDA\lib instead of C:\CUDA\lib64 arrh). So far it’s slower than the PC though with the Szeta example, though the PC is pretty new.

How could I get this working if I am on a 64-bit system (Windows XP x64 Pro) but still using Matlab 2008b 32-bit? :ermm:

I have Cuda 2.2 and VS2008 Express.

I’ve searched everywhere and it doesn’t seem like anyone is using my setup.

(Unfortunately, I am forced to use Matlab 32-bit… Mathworks is still not able to provide a 64-bit version of the Excel add-in compiler… :verymad: )

Thanks guys

Big thanks for help.

I’ve meet same problem ie.

nvcc fatal : Visual Studio configuration file ‘(null)’ could not be found for installation
configuration: Windows 7 64 bit, CUDA 2.3 and Visual Studio Express 2008, SDK v7.0

Proposed solution can be simplified by empty file vcvarsamd64.bat. This is also working fine.


Thanks for the files. It seems to work now.

I made a guide to help people still strugling to get it to work.

I used windows 7 64bit and Matlab r2010A 64bit and CUDA 3.1.

Guide + files are attached to this post.

Note that I did not create these files. I just took them from the original post. Please let me know if there are serious errors in this guide.
MEXguide.rar (29.6 KB)
MEXguide.pdf (47.5 KB)


This short tut got it finally working on my system

(Win7SP1 x64, Matlab 2008b 64bit, Cudatoolkit 3.2,Microsoft Visual Studio 2008 Express (2010 also installed),Microsoft SDKs v7.0A).

With some small modifications necessary:

[indent]set SDKDIR=C:\Program Files\Microsoft SDKs\Windows\v7.0 (using the 32BitPath gave me akernel32.lib error)

nvmex -f nvmexopts.bat -IC:\cuda\include -LC:\cuda\lib\x64 -lcudart -lcufft (guess cause i use 3.2 not 3.1)[/indent]

Maybe you should add Microsoft SDK with option “redistributable…” checked to required software.

Thanks again and please dont care my spelling its late at night spellcheck doesnt work and im german


Hi All,

Many thanks for putting together this collection of files. Unfortunately, I have a small problem compiling the for my configuration:

Win Vista 64bit
Matlab 2007b
Cuda 2.2
VS2008 express

When I try to compile:

“nvmex -f nvmexopts.bat -IC:\cuda\include -LC:\cuda\lib -lcudart -lcufft”

I get the error:

"Can’t locate File/ in @INC (@INC contains: C:/Program Files/MATLAB/R2007b/sys/perl/win32/lib C:/Program Files/MATLAB/R2007b/sys/perl/win32/site/lib .) at C:\Program Files\MATLAB\R2007b\bin\ line 126.
BEGIN failed–compilation aborted at C:\Program Files\MATLAB\R2007b\bin\ line 126.
??? Error using ==> nvmex at 206
Unable to complete successfully.

Error in ==> example_test_compile1 at 1
nvmex -f nvmexopts.bat -IC:\cuda\include -LC:\cuda\lib -lcudart -lcufft"

(Note that Cuda 2.2 64-bit install seems to only have a \lib directory, which I assume contains 64bit libraries)

After sniffing around, I guess the problem is related to the version of Perl installed with Matlab 2007b.
In ‘C:\Program Files\MATLAB\R2007b\sys\perl\win32\bin’ it appears I have perl5.00503.

Line 126 of (where the crash seems to arise) is:
“use File::Temp qw/ tempdir/;”

To be honest, I don’t know why this fails, but there is indeed no existing file in the @INC path (see the error text above) called “”.

Do I just have to install a newer version of Perl in the Matlab sys directory?
I would just go ahead and try this, but the forums I found on updating Matlab’s Perl - e.g. - make me a little hesitant, unless someone tells me this will fix the problem.

Many thanks for any advice.

I have a 64 bit machine, and using the command below to compile the .cu file.

nvmex -f nvmexopts_9.bat -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" ...

    -L"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\lib\x64" ...

    -lcudart -lcufft

But, I had an error … anyone with a solution. thanks

example.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64' 

C:\PROGRA~1\MATLAB\R2010A\BIN\NVMEX.PL: Error: Link of 'example.mexw64' failed.