Karthik_Ganesan:

EDIT: I tried renaming both files to .cu to use the NVCC compiler for both and it seems to work. But I’m not sure if that it the right way to fix this.


It is. The CUDA kernel launch syntax is not standard C++, hence it fails when you compile with a regular C++ compiler. If you don’t like that, you could put only CUDA code inside the .cu file, define wrappers inside that same .cu file which will simply launch the kernels, and then export those wrappers so that you could use them (and not the CUDA kernel launch syntax) from your other .cpp files.