NVCC compiler options How to compile multi-file projects and include libraries


I am compiling and running cuda code on a linux (ubuntu) box. So far, I have used the make files provided by the SDK to compile my code. However, I would like to know how to compile using “nvcc…” in command line. I’ve run into a trivial problem: When I try to compile a project that involves one .cu source file and several .c files, the compiler doesn’t recognize the .c files, and produces an “undefined reference” error where functions in the .c files are invoked in the .cu file. How can I modify my compiler command to overcome this error? Currently, my command is like this: nvcc mainfile.cu file1.c file2.c file3.c -o mybinary.o

On a related note, how can I add library references to my make files?

Thank you,