problems with compilation

I have some troubles. I use the updated files ( and nvmexopts.bat ) to compile CUDA plugins in MATLAB R2008a, and met error:

nvmex -f nvmexopts.bat -IC:\cuda\include -LC:\cuda\lib -lcufft -lcudart
nvcc fatal : Cannot find compiler ‘cl.exe’ in PATH

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

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

Can anybody help me with this problem?

I have Windows 7, visual studio 2008, cudasdk 2.2

I think your software may be partially installed, try to reinstall it you will find the solution.

I am experiencing the same trouble, but am working with code in C. I have had some luck narrowing down the problem. I just started using VisualStudio a few days ago and only learned C a week ago, so please forgive me if my understanding of everything is not 100% correct.

NVCC requires a host compiler to operate. VisualStudio is the preferred host compiler; I am not sure if others are supported. The cl.exe referred to in this error is the executable file generated by VisualStudio. This file needs to be located in the same execution path as the NVCC compiler (it can be called from a different location with a little more work). My understanding gets a little sketchy at this point.

The only executable generated by VS when the code is compiled is one by the same name as the source code with .exe suffix. I am not sure where the cl.exe is located. You might want to check out this link, it has a brief but helpful description of how the NVCC compiler functions:

I have tried uninstalling/reinstalling the CUDA software several times but the sample codes work fine so I don’t think that is the problem for me. My guess is that the way we are implementing our codes is not correctly using the NVCC compiler.

Like I said, I am working on fixing this problem myself so I don’t have much more to offer. Hopefully this information can get one of us a step further. I’ll keep you posted on any developments.

Ok, I got mine working and as promised here is how I did it:

If everything is installed correctly you are probably making the same mistake that I did. I was trying compile the code from the windows command prompt. This seems logical, but the reason you are getting the cl.exe error. You actually have to use the Visual Studio Command Prompt. Compiling your code using this command prompt will allow it to access the cl.exe compiler and run the code appropriately. The command prompts are the same.

Here is a link that will show you how to access and use the Visual Studio command prompt:

Now I just need to figure out how to make a batch file that can call the compile script using VS command prompt instead of regular cp…