Linking errors while compiling

Hi,

I am using Windows 7 64 bit and Visual Studio 2008

I installed CUDA and can compile SDK samples (for example Mandelbrot) so i think I have properly configured system.

But I have errors while I want to compile my program (which compiles on Linux without errors or warnings).

Here is Build Output:

1>------ Rebuild All started: Project: CUDA uczelnia 1b, Configuration: Debug x64 ------

1>Deleting intermediate and output files for project 'CUDA uczelnia 1b', configuration 'Debug|x64'

1>Compiling with CUDA Build Rule...

1>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\bin\nvcc.exe"    -gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\"  --machine 64 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin"    -Xcompiler "/EHsc /W3 /nologo /O2 /Zi   /MT  " -I"C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\common\inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\include" -maxrregcount=32  --compile -o "x64\Debug/main.cu.obj" main.cu 

1>main.cu

1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\INCLUDE\windef.h(123) : warning C4005: 'CALLBACK' : macro redefinition

1>        C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\common\inc\GL/glut.h(33) : see previous definition of 'CALLBACK'

1>tmpxft_00001424_00000000-6_main.compute_20.cudafe1.gpu

1>tmpxft_00001424_00000000-10_main.compute_20.cudafe2.gpu

1>main.cu

1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\INCLUDE\windef.h(123) : warning C4005: 'CALLBACK' : macro redefinition

1>        C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\common\inc\GL/glut.h(33) : see previous definition of 'CALLBACK'

1>tmpxft_00001424_00000000-3_main.compute_10.cudafe1.gpu

1>tmpxft_00001424_00000000-14_main.compute_10.cudafe2.gpu

1>main.cu

1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\INCLUDE\windef.h(123) : warning C4005: 'CALLBACK' : macro redefinition

1>        C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\common\inc\GL/glut.h(33) : see previous definition of 'CALLBACK'

1>main.cu

1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\INCLUDE\windef.h(123) : warning C4005: 'CALLBACK' : macro redefinition

1>        C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\common\inc\GL/glut.h(33) : see previous definition of 'CALLBACK'

1>tmpxft_00001424_00000000-6_main.compute_20.cudafe1.cpp

1>tmpxft_00001424_00000000-23_main.compute_20.ii

1>Note: including lib: glut32.lib

1>Compiling with CUDA Build Rule...

1>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\bin\nvcc.exe"    -gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\"  --machine 64 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin"    -Xcompiler "/EHsc /W3 /nologo /O2 /Zi   /MT  " -I"C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\common\inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\include" -maxrregcount=32  --compile -o "x64\Debug/kernel.cu.obj" kernel.cu 

1>kernel.cu

1>tmpxft_00000fa0_00000000-6_kernel.compute_20.cudafe1.gpu

1>tmpxft_00000fa0_00000000-10_kernel.compute_20.cudafe2.gpu

1>kernel.cu

1>tmpxft_00000fa0_00000000-3_kernel.compute_10.cudafe1.gpu

1>tmpxft_00000fa0_00000000-14_kernel.compute_10.cudafe2.gpu

1>kernel.cu

1>kernel.cu

1>tmpxft_00000fa0_00000000-6_kernel.compute_20.cudafe1.cpp

1>tmpxft_00000fa0_00000000-23_kernel.compute_20.ii

1>Compiling manifest to resources...

1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0

1>Copyright (C) Microsoft Corporation.  All rights reserved.

1>Linking...

1>main.cu.obj : error LNK2005: "int __cdecl scale(float,int)" (?scale@@YAHMH@Z) already defined in kernel.cu.obj

1>main.cu.obj : error LNK2005: "void __cdecl __device_stub__Z12computeFieldP6uchar4iiPfii(struct uchar4 *,int,int,float *,int,int)" (?__device_stub__Z12computeFieldP6uchar4iiPfii@@YAXPEAUuchar4@@HHPEAMHH@Z) already defined in kernel.cu.obj

1>main.cu.obj : error LNK2005: "void __cdecl computeField(struct uchar4 *,int,int,float *,int,int)" (?computeField@@YAXPEAUuchar4@@HHPEAMHH@Z) already defined in kernel.cu.obj

1>main.cu.obj : error LNK2005: "void __cdecl __device_stub__Z9updatePosPfS_iiii(float *,float *,int,int,int,int)" (?__device_stub__Z9updatePosPfS_iiii@@YAXPEAM0HHHH@Z) already defined in kernel.cu.obj

1>main.cu.obj : error LNK2005: "void __cdecl updatePos(float *,float *,int,int,int,int)" (?updatePos@@YAXPEAM0HHHH@Z) already defined in kernel.cu.obj

1>C:\Users\michal\Documents\Visual Studio 2008\Projects\CUDA uczelnia 1b\x64\Debug\CUDA uczelnia 1b.exe : fatal error LNK1169: one or more multiply defined symbols found

1>Build log was saved at "file://c:\Users\michal\Documents\Visual Studio 2008\Projects\CUDA uczelnia 1b\CUDA uczelnia 1b\x64\Debug\BuildLog.htm"

1>CUDA uczelnia 1b - 6 error(s), 4 warning(s)

========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

I think it’s something in my project configuration. I tried to follow some internet tutorials (how to run CUDA on VS2008) but i can’t solve this problem.