Problem compiling matlab plug-in on linux

Hello, when compiling the matlab mex plugin on a linux 64-bit machine, I get the following errors… Of course, I have installed CUDA to /usr/local/cuda and compiling non-openGL examples in the toolkit (such as the convolution code) works fine and tests pass. Any ideas would be hugely appreciated… Thanks!!

/usr/local/matlab_2007a_x64/bin/mex CFLAGS=’-fPIC -D_GNU_SOURCE -pthread -fexceptions’ COPTIMFLAGS=’-O3 -funroll-loops -msse2’ fft2_cuda.c
-I/usr/local/cuda/include -L/usr/local/cuda/lib -lcufft -Wl,-rpath,/usr/local/cuda/lib
fft2_cuda.o(.text+0x87f): In function mexFunction': fft2_cuda.c: undefined reference to cudaMalloc’
fft2_cuda.o(.text+0x894):fft2_cuda.c: undefined reference to cudaMemcpy' fft2_cuda.o(.text+0x8dc):fft2_cuda.c: undefined reference to cudaMemcpy’
fft2_cuda.o(.text+0x92f):fft2_cuda.c: undefined reference to `cudaFree’
collect2: ld returned 1 exit status

mex: link of 'fft2_cuda.mexa64' failed.

make: *** [fft2_cuda.mexa64] Error 1

Use the script available from:

or add -lcudart to your command line

add -lcudart to your command line : worked for me (openSuSE 11.1 , matlab 2008a) thank you