Compiling with CUDA nvcc

Hello,everybody:
I am now trying to use CUDA to modify a source code and I am now learning to build an exectable with both nvcc and gcc,
but I failed,I am building the matrixMul example, did you compiled successfully manually?

the source files are matrixMul.cu matrixMul_kernel.cu matrixMul_gold.cpp matrixMul.h

and my way is:
nvcc -c matrixMul.cu
nvcc -c matrxMul_kernel.cu
gcc -c matrixMul.gold.cpp

these three steps are OK
but the last link step failed:
g++ -fPIC -o matrixMul matrixMul.o matrixMul_kernel.o matrixMul_gold.o

Obviously.

Try adding the cuda libraries to the link stage. The SDK sample makefiles contain everything that is required.

Thanks for your reply!