Compiling CUDA 3.2 in Visual Studio 2008

Hi, I work with CUDA in Linux at my workplace. However i recently bought a laptop with a Geforce 310M given that I was tired of not being able to connect to my computer through VPN.

Anyway I am having the hardest time of my life just trying to compile CUDA in Visual Studio 2008 (I am using Windows 7 64 bits). I have followed around 5 different tutorials and none works:

Tutorial1

Tutorial2

And a lot more…The last one I tried was this

Tutorial3

And when I build the project I get this

1>------ Build started: Project: teste2, Configuration: Debug Win32 ------

1>Compiling with CUDA Build Rule...

1>"\bin\nvcc.exe"    -gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\"  --machine 32 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin"    -Xcompiler "/EHsc /W3 /nologo /O2 /Zi   /MT  "  -I"\include" -maxrregcount=32  --compile -o "Debug/hello.cu.obj" hello.cu 

1>O sistema não conseguiu localizar o caminho especificado.

1>Project : error PRJ0019: A tool returned an error code from "Compiling with CUDA Build Rule..."

1>Project : warning PRJ0018 : The following environment variables were not found:

1>$(CUDA_PATH_V3_2)

1>Build log was saved at "file://c:\Users\Bernardo\Documents\Visual Studio 2008\Projects\teste2\teste2\Debug\BuildLog.htm"

1>teste2 - 1 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Any help would be appreciated as I can freely replace my laptop within next week, and if I can’t compile CUDA here, I could buy a better laptop(This Asus’ model has a defective keyboard)

P.S: I tried following the last tutorial replacing (CUDA_PATH) with (CUDA_PATH_V3_2) but the result is the same

Look at custom build step in Project Properties. That should solve your problem…

What should I add/modify? Sorry but it’s the first time I install VS, setting up this kind of things is not so easy for me External Image

It looks like a windows-system-variable has not been set. I recommend installing “Rapid Environment Editor” (Google it) and adding

a variable CUDA_PATH with the value: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\ (or wherever you have your Cuda files)

You can also set a system variable over windows. I have a German Windows 7 installation, so my translation might not be exactly accurate:

System-Controls->System>Advanced Settings (on the left hand side) ->Environment Variables… and then set a System-variable (not a user one)

Start with empty project or console project, and then slowly start adding things like cuda headers or paths and cuda.lib stuff like that.

Alternatively simply use nvcc command line compiler to compile ptx and program directly against api/dll/driver api…

But ofcourse having c/c++ work with <<< >>> and what not would be nice.

This will work as soon as you add cuda.h to your project probably… plus maybe some paths…

Yeah paths too (maybe)…search forum…