Compiling an example program

Hello. I tried to compile the matrix multiplication example program using this instructions:
[i]The setup to create a new project, by hand, is not very easy, and i lost a lot of time trying to compile my first program with success.

This is a quick guide, from my personal experiences:

* Download & Install CUDA 2.1 & the CUDA SDK, from the nVidia site.

* Open VS 2008, and start a new C++ Win32 Console project.

* Right click in the name of the project in the solution explorer, and select 'Custom Build Rules'. A new window will open. Click on 'import' and select the file "C:\CUDA SDK\common\CUDA.rules". Then mark the checkbox for the CUDA files.

* Rename the main .cpp file to .cu

* Right click on the .cu file and select 'properties'. Select 'CUDA Build Rule 2.1.0' in General - Tool.

* Open the properties of the project, and change:



          o Additional include directories: $(CUDA_INC_PATH);$(NVSDKCUDA_ROOT)\common\inc
          o Debug Information Format: Program Database (/Zi)

      Code Generation

          o Runtime Library: Multi-threaded Debug (/MTd)



          o Enable incremental linkin: No (/INCREMENTAL:NO)
          o Additional Library Directories: $(CUDA_LIB_PATH);$(NVSDKCUDA_ROOT)\common\lib


          o Additional Dependencies: cudart.lib cutil32D.lib


          o Enable COMDAT folding: Do Not Remove Redundant COMDATs (/OPT:NOICF)

Then, edit your .cu file, and put your kernel there.[/i][/b]

But I don’t get how am I supposed to do the last part (“Then, edit your .cu file, and put your kernel there.”).
Also, when I try to build it, I get this message:

1>LINK : fatal error LNK1181: cannot open input file ‘cudart.lib’

I’m using CUDA2.1 and VS2008 on Windows XP SP2.

I have an Idea for you.
Open a SDK sample,

  1. right click on project, take alook at the properties;
    You pay attention at C/C++ and Linker in Property pages.
  2. right click on *.cu file and see what is setted in property pages->custom build step->general
    gook luck.


I have a graphics card GeForce 8600M GT in a notebook dell inspiron 1520 and recently installed CUDA SDK 2.2, CUDA Toolkit SDK and the nVIDIA driver “185.85_notebook_winxp_32bit_whql.exe”. I am also trying to integrate CUDA but with Visual Studio 2005 C++. I still do not achieve it manually, but there are a few hints that you might like to follow:

  1. Go to and download the project wizard offered by kyzhao to integrate CUDA with VS2005. Intall it and then create this already-configured project and replace the existing code with your code. I have tested it and it works well.

  2. You can do it through CUDA Build Rules for Visual Studio 2005 as mentioned here…-with-visual-c/

  3. In the aforedmentioned website there are 2 options more for integration (manually and by adding a new build configuration).

I hope it helps you,

Geovanny Giorgana