Mathlab link with cuda failed

I am trying to compile the sample Szeta.m for Mathlab with CUDA.

To do it I have to compile few files with CUDA functions. It fails:

mex fft2_cuda.c -IC:\CUDA\include -LC:\CUDA\lib -lcudart -lcufft
Writing library for fft2_cuda.mexw32
c:\docume~1\ponizovs\locals~1\temp\mex_6b~1\fft2_cuda.obj .text: undefined reference to ‘_cudaMalloc@8’
c:\docume~1\ponizovs\locals~1\temp\mex_6b~1\fft2_cuda.obj .text: undefined reference to ‘_cudaMemcpy@16’
c:\docume~1\ponizovs\locals~1\temp\mex_6b~1\fft2_cuda.obj .text: undefined reference to ‘_cufftPlan2d@16’
c:\docume~1\ponizovs\locals~1\temp\mex_6b~1\fft2_cuda.obj .text: undefined reference to ‘_cufftExecC2C@16’
c:\docume~1\ponizovs\locals~1\temp\mex_6b~1\fft2_cuda.obj .text: undefined reference to ‘_cufftDestroy@4’
c:\docume~1\ponizovs\locals~1\temp\mex_6b~1\fft2_cuda.obj .text: undefined reference to ‘_cudaFree@4’

C:\PROGRA~1\MATLAB\R2008B\BIN\MEX.PL: Error: Link of ‘fft2_cuda.mexw32’ failed.

??? Error using ==> mex at 213
Unable to complete successfully.

What I am doing wrong? Might be I should change anything in mex.pl. I think I added any possible paths in Set Path in Mathlab.

I think you need to add -lcuda to the command line like

mex fft2_cuda.c -IC:\CUDA\include -LC:\CUDA\lib -lcudart -lcuda -lcufft
But I must say I am not completely sure, if you don’t manage to get it working pm me, then I will check what I changed in linux to make it work. It might be that you can already find the answer by searching the forum.

No, unfortunately did the same. Exactly the same error. And I am still looking for the answer. :unsure: