gcc -L/usr/local/cuda/lib -lcudart -o program main.o cuda.o
The last line, the linking, gives me this:
main.o: In function `main’:
main.c:(.text+0x12): undefined reference to `myfunc’
collect2: ld returned 1 exit status
Had cuda.cu been a regular c file compiled with gcc, this would’ve worked and main() would’ve seen myfunc, but with nvcc this isn’t the case. What am I doing wrong?
Note that I need to build main.c with gcc and I also need to link with gcc, so replacing gcc with nvcc is not an option right now.