Cant link object files - missing a step? Cant seem to link the example obj files

Hi everyone,

I am trying to compile a CUDA boxFilter example from the command line to get a good grasp on CUDA compilation.

From the command line here is what I typed:

nvcc -I /Desktop/CUDA/NVIDIA_CUDA_SDK_MACOSX/common/inc -c *.cu

That gave me the following obj files:
boxFilter.o and boxFilter_kernel.o so far so good…

Then I had to compile the boxFilter_gold.cpp file (whats with all the examples having “gold” in the name anyway. Is that significant?)

nvcc -c boxFilter_gold.cpp
That compiles and gives me: boxFilter_gold.o

Now when I try to link them with the command: nvcc *.o I get an error…
ld: duplicate symbol ___device_stub__Z17d_boxfilter_y_texPfiii in boxFilter_kernel.o and boxFilter.o

Am I missing a step or a library?

Thanks for having a look.

Hi Jeff,

Error occurs, Since you are trying to build both and

There is no need to compile since it is included in the file.

You need to build the boxFilter_gold.cpp file anyway since it contains the CPU implementation for reference test. (I don’t know what is meant by gold. May be NVIDIA thinking about “Good OLD” :smile: )

This will help you to get out of the problems.


Why you are trying to compiling it from command line?

you may produce make command instead?

Thanks Sibi! I’m new so thanks for taking the time to look. I just wanted to try to do it from the command line first so I had a better understanding of what to put in my own Makefile. (pondering CMAKE at the moment) but thanks again.