How to use CUDA in VS2005?

I did follow:
(1) set the “cuda.rules” in vs2005
(2) set the “D:\CUDA\lib” and “D:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\lib” option
(3) add “cudart.lib” and “cutil32D.lib”
but my debug output "could not open source file ‘cutil.h’ ", I think some option or path are wrong , how to confige vs2005? If I want EmuDebug the project, how to set?
thank you!

Here’s the guide I’ve developed over the past two weeks. I’ve gotten to where I can compile in VC++ Express, so now I can start looking at editing and creating my own. This is still a rough draft and I hope to polish it up a bit more before officially releasing it (Adding hyperlinks, etc.)

CUDA setup for Newbie’s

1)You will need the following hardware to run CUDA in non-emulation mode:
A 8x00 nVidia graphics card (e.g. 8400, 8500, 8600, 8800) or newer
–OR –
A Quadro 4600 or Quadro 5600 workstation graphics card
An nVidia Tesla computing system

You may run CUDA program in emulation without this hardware if you choose.

2)Download and install the following software from the nVidia website:
NVIDIADisplayWin2KXP(162.01)_Int.exe - these display drives are only needed if you choose to run non-emulated programs
NVIDIA_CUDA_Toolkit_1.0.exe (Installs to C:\CUDA by default)
NVIDIA_CUDA_SKD_1.0.exe (Installs to C:\Program Files\NVIDIA CUDA SDK by default)

3)Download and install Microsoft Visual Studio C++ Express (it’s free). Most of the sample CUDA programs are Visual C++ projects. If you have problems with Microsoft’s auto-downloader, you can manually get the CD .iso file.

4)Go to the directory \NVIDIA CUDA SDK\doc\syntax_highlighting\visual_studio_8 and copy the usertype.dat file to \Microsoft Visual Studio 8\Common7\IDE. Generally $ = C:\Program Files in both cases.

5)Download the file by JaredHoberock and unzip the contents to a convenient (and permanent) directory.
1.Direct Visual C++ to use this file on an open project by Selecting Project>>Custom Build Rules… from the menu and click the Find Existing… button. Visual C++ will ask you navigate to and open the rules file that you unzipped and will then ask if you want to add this directory to the rules search path. Do so. The Rule CUDA should now appear under Available Rule Files. Place a check mark next to CUDA to actually use it in this project.
2.Select Tools>>Options… from the menu and then select Projects and Solutions>>VC++ Directories from the options tree. Select Include files from the “Show directories for” drop down and add the directory “$\NVIDIA CUDA SDK\common\inc” to the list, where is the parent directory of the CUDA SDK. 3.Select project>>properties from the menu. Select Linker>>General from the properties tree. The list to the right should have an entry Called “Additional Library Directories.” Add the directory \CUDA\lib.
6)If you want to run the SDK samples from somewhere other than your “Program Files” directory, it is recommended that you copy the entire \NVIDIA CUDA SDK\ folder so that relative links to header and libraries within the SDK still work.

Good Luck :)

thank you very much!
I could compile and run in Debug mode, and do you know how to confige vs2005 that make my own project run in EmuDebug mode?

IMU all you need is to create new EmuDebug configuration (inherit properties from Debug) in “Configuration Manager” and set -emudevice parameter for nvcc in this configuration.

That was a great help, i still have a couple of problems though.

So i’m new to cuda and VS, i’m just starting a project for my university. I followed all ur steps and tried compiling a new project ‘image’ which is basically ‘matrixmul’ from the examples. individually, the different parts of the source code compile, but when i try to build the solution i get the following error. Can you please run me through exactly what i need to do? I think the problem is because i’ve put all the files (CUDA SDK and CUDA in my z drive on the server", i followed all the steps but it still isnt working. The example programs compile fine.


1>matrixmul_kernel.obj : error LNK2005: ___device_stub_matrixMul already defined in matrixmul.obj

1>LINK : warning LNK4098: defaultlib ‘LIBCMTD’ conflicts with use of other libs; use /NODEFAULTLIB:library

1>Debug\image.exe : fatal error LNK1169: one or more multiply defined symbols found

1>Build log was saved at “file://z:\NVIDIA SDK 10\NVIDIA CUDA SDK\projects\image\Debug\BuildLog.htm”

1>image - 2 error(s), 1 warning(s)


k i got most of it fixed :P