Problems while linking nvcc generated objects with gcc


I have to integrate a cuda kernel in an existing C program, but I am having troubles linking all the things togheter.

I generate the object with nvcc with this command:

$ nvcc --compiler-options -fno-strict-aliasing -I. -I/opt/cuda/NVIDIA_CUDA_SDK/common/inc -I/opt/cuda/include -DUNIX -o CUDA_OBJECT.o -c

And I try to link all teh objects with this gcc command:

gcc -o EXECUTABLE C_OBJECT1.o C_OBJECT2.o CUDAO_BJECT.o -L/opt/cuda/lib -lcudart -L/opt/cuda/NVIDIA_CUDA_SDK/lib -lcutil

What I get is an error in the CUDA host code, it can’t find the implementation of a function defined in one of my C objects.

Am I missing something?


I solved declearing the included headers as extern “C”.