# CUDA visual studio integration

This topic is 2797 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey guys

Im trying to set up my visual studio project to be able to compile the .cu files to be compiled by nvcc (cuda compiler)

Im having some trouble with it. I am using a university computer (because its graphics card is far better than my own, 64 bit machine too) and had the technician get the "Developer Drivers for WinVista and Win7 (260.61)" and "CUDA Toolkit" from http://developer.nvidia.com/object/cuda_3_2_toolkit_rc.html. Looking on this list, I thought that would be all that I need.

In visual studio, under Tools > Options, I have linked the relevant executables, include, and library folders in the NVIDIA GPU Computing Toolkit directory (both 32 bit and 64 bit just to be sure).

In the project settings, In Linker > general I added "$(CUDA_LIB_PATH);$(NVSDKCUDA_ROOT)\common\lib" to the additional library directories. In Linker > input I added cudart.lib and cutil32.lib to additional dependencies.

When I compile, I get the error "fatal error LNK1104: cannot open file 'cutil32.lib'"" The same thing happens if i try including cutil32D or cutil64D etc. If I remove them from the dependencies I get "error LNK2001: unresolved external symbol _mainCRTStartup"

So obviously I am missing cutil32D. Browsing the internet reveals that it "comes with the sdk" but the website only offers "SDK Code examples", So I think I installed everything I need but I cant find that file on the computer.
Any help would be appreciated cheers

##### Share on other sites
As far as I remember this is a little utility library for the samples that you have to build yourself. There should be a solution "ready to hit F7" somewhere.

EDIT: According to this document it is in NVIDIA GPU Computing SDK\C\common\src.

##### Share on other sites
thats the wierd thing. the directory structure is different to what it says in the docs. I cant get to my university computer until monday, but I will give the sample projects a try. cheers

##### Share on other sites
hey guys i THINK that cuda has been updated so that the sdk and toolkit arent seperate anymore? so the directory structure is different. also, the help files like "getting started" dont seem to have been updated. so i cant "verify the installation" using the sample programs because they arent there

this is really confusing me. if anyone else has managed to compile a .cu file in visual studio 2008 let me know please. Im not even sure if you have to use .cu files or just write the kernal in the cpp files

any help is muchly appreciate, cheers

##### Share on other sites
We are using cmake, so I'm using an adapted version of nvidia's cmake scripts to compile from VS. But it shouldn't be too hard to define your own custom build rule for .cu files. Maybe somebody already did this and published the rule file. Also, have you tried the nvidia forums already? They would have been my first address for this kind of problem.

##### Share on other sites
Ok, I don't know if this will help you much, but I just installed the CUDA toolkit 3.2 + SDK samples (wanted to upgrade anyway) and everything is where it's supposed to be.
The only thing that didn't went smoothly was that the build rules weren't installed automagically.
I had to copy the .rules files from
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\extras\visual_studio_integration\rules

to
C:\Program Files\Microsoft Visual Studio 9.0\VC\VCProjectDefaults

After the installation I had to update my PATH because it contained an old CUDA installation.
(For the examples you need to have the CUDA_PATH environment variable defined, too, but the installer should do this for you.)
Then everything compiled and ran fine.

1. 1
2. 2
3. 3
4. 4
Rutin
17
5. 5

• 12
• 9
• 12
• 37
• 12
• ### Forum Statistics

• Total Topics
631419
• Total Posts
2999985
×