cuda link error link errror while compiling first progra

hi all

i am new to cuda,and started to work with cuda for university project

i ran the cuda sdk project files in vc 2005, and the program executed perfectly.

so i copied the same bandwidthtest folder, gave different name, and included my test files transpose.cu and transpose_kernel.cu
using hte cuda.rules build file

but when compiling, it is giving me link error
error LNK2005: ___device_stub___globfunc__Z9transposePfS_ii already defined in transpose.obj

i have cuda.lib cudart.lib cutil32D.lib
in the additional linker dependency

please help me solve this problem

you take a look at this site
http://forums.nvidia.com/index.php?showtopic=64478&hl=
this method i use for xp, but you can use for vista.
I tried, and it works perfectly. In vista you find the cutil32.dll copy and paste to your project.
good luck :D

This sounds like a #include issue rather than a dll issue. If you’re doing something like #include “transpose_kernal.cu” from another file, you’ll have to explicitly EXCLUDE it from the build. In C/C++ #include basically tells the compiler to copy the entire file and paste it in right there. Thus, if Foo.cpp includes transpose_kernal.cu, and transpose_kernal.cu is also in the build, it will compile it twice, then get confused when the linker tries to link it in.

To exclude a file from the build, right click on the file it the solution explorer, hit properties from the pop-up menu, then go to the Configuration Properties->General tab and turn on the excluded from build setting there.

Note, however, if you want to use the MSVC compiler anywhere (i.e. windows GUI stuff), you’ll need to make sure that you go through a .h file and extern the entrypoints for the nvcc (cuda) compiled parts. You will have fun with this, especially when you have to perform a quarantine between the code sections to prevent the standard library files from seeing the cuda library files and declaring war on each other (conflicting).

Thanks.The problem has been solved .