I have implementation for two classes in four different files (separate .cpp/.cu and .h for each). The problem is that when I compile the code using this command:
$ nvcc -lcuda -lineinfo -o test -I src src/schd.cpp src/ctx.cu test.cpp
I get "undefined reference to" errors for each class variables like this:
/usr/bin/ld: /tmp/tmpxft_000081c8_00000000-9_schd.o: in function `FGPRS::Scheduler::destroyAll()':
schd.cpp:(.text+0x37e): undefined reference to `FGPRS::Scheduler::_poolSize'
and it happens only for class variable members, not functions. Even though I'm using CUDA compiler (nvcc), I believe this should be a C++-related problem and has nothing to do with CUDA and this would happen even in the case of native C++ compiler (using gcc command).