Compiling CUDA with SCons pulling hair out

I have been going crazy trying to get SCons to compile one of the SDK examples, cppIntegration.

This is the output it generates:

scons: Building targets …
g++ -o cppIntegration_gold.o -c -m32 “-I/Developer/GPU Computing/C/common/inc” -I/usr/local/CUDA/include -I/usr/local/include cppIntegration_gold.cpp
g++ -o main.o -c -m32 “-I/Developer/GPU Computing/C/common/inc” -I/usr/local/CUDA/include -I/usr/local/include main.cpp
nvcc -o cppIntegration.o -c -I “/Developer/GPU Computing/C/common/inc” -I /usr/local/CUDA/include -I /usr/local/include cppIntegration.cu
nvcc -o cppIntegration_kernel.o -c -I “/Developer/GPU Computing/C/common/inc” -I /usr/local/CUDA/include -I /usr/local/include cppIntegration_kernel.cu
g++ -o cppIntegration -m32 -Xlinker -rpath /usr/local/cuda/lib cppIntegration_gold.o main.o cppIntegration.o cppIntegration_kernel.o “-L/Developer/GPU Computing/C/lib” “-L/Developer/GPU Computing/C/common/lib/darwin” -L/usr/local/CUDA/lib -L/Developer/SDKs/MacOSX10.6.sdk/usr/X11/lib -lcudart
ld: duplicate symbol __device_stub__Z7kernel2P4int2(int2*) in cppIntegration_kernel.o and cppIntegration.o
collect2: ld returned 1 exit status

So it’s saying there’s a duplicate symbol, which I think must be caused by cutil_inline.h which both main.cpp and cppIntegration.cu include. I can’t figure out how to modify the code to make it compile.

It has nothing to do with cutil. Don’t compile and link cppIntegration_kernel.cu and it should work.

It has nothing to do with cutil. Don’t compile and link cppIntegration_kernel.cu and it should work.