cuda mex file

please can anybody tell me how can I compile a cuda mex file with visual studio 2010 windows 7 64bit matlab r2011b cuda 4.0.
Since I have also Visual studio 2008 installe I tried to use this configuration http://forums.nvidia…a/gpu/index.htm
but I always obtain this error:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN/…/…/VC/\INCLUDE\ crtdefs.h(490): error: invalid redeclaration of type name “size_t”

Any ideas?
Thanks in advance.

consider using just a plain batch file to compilte the MEX itself.

  1. Let VS compile your different .obj for your compilation units
  2. run a batch script that uses the mex compiler and links with these .obj:s

batch file ex:

mex -v -L"%CUDA_PATH%\lib\x64" -lcudart -I"%CUDA_PATH%\include