Create you own CUDA program on VS C++ 2005 The way to creat a CUDA program on VS

Hi everybody.
I had write some CUDA program under Linux and it work well.
when i chance it to window I get some problem. So now i can solve my problem
it take me much time. I had referent some thread in this forums to solve this problem and I think that it very helpful for other person like me to getting start with CUDA I will show my experience. :)

1>in the visual studio or another Enviroment when to create cuda program you should use 3 files
_ a *.cpp file (I alway use it to write main() function and in main() function I will call a Cuda function to tranfer data from CPU to GPU)
_b .cu fiel (in this file I usually have 2 fucntions )
once: to tranfer data from CPU to GPU and GPU to CPU (example tranfer(float
A);) and this function will call kernel function for calculate.
two: a kernel function to calculate
_c *.h file the prototype of the function which you define in .cu file will store here.
(remember to use extern"C" keyword. example i want to prototype the tranfer function I must write: extern"C"{void tranfer(float
A);}; )

2>now you has to tell to VS the rule to compile *.cu file (thank you JaredHoberock) :D
dowload build rule from
To install the rule:
right-click on your project in Visual Studio 2005
click Custom Build Rules…
click Find Existing…
browse to cuda.rules
check the box next to the CUDA listing in the Available Rule Files pane
click ok

3>let tell to vs the directory which store some library file you need to use in your program.
right-click on your project in Visual Studio 2005
click properties->C/C+±>General->Additional Include Directories
you type the directory: (CUDA_INC_PATH);./;../../common/inc right-click on your project in Visual Studio 2005 click properties->Linker->Input->Addition Dependences you need some library: cutil32D.lib cudart.lib cutil32.lib right-click on your project in Visual Studio 2005 click properties->Linker->General->Addition Libraries Directories you need to show vs the directoryof these libraries: (CUDA_INC_PATH);./;…/…/common/lib;“C:/Program Files/NVIDIA Corporation/NVIDIA CUDA SDK/common/lib”;“C:/CUDA/lib”

4> let make up your *.cu file (for easy to read)
goto C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\doc\syntax_highlighting\visual_studio_8 and copy file usertype.dat and then save to “Microsoft Visual Studio 8\Common7\IDE\usertype.dat”
Start Visual Studio 8. Select the menu “Tools->Options…”. Open “Text Editor” in the tree view on the left, and click on “File Extension”. Type cu in the “Extension” box, and click “Add”. Click “OK” on the dialog box.
Restart Visual Studio and ENJOY IT. :D :D

(My english is bad) :">