Search code examples
gcccmakecudalinker-errorsnvcc

CUDA: Modifying CMake causes linking error


I had a CMake project. In order to use some cuda kernels in the project, i tried to first changed the name of mian.c to main.cu.

When i cmake the project, the Makefile is generated fine but when i try to build the project using make, the building process prompt me following:

main.cu: undefined reference to <ftns>

The building process works perfectly fine when i modify the main.cu to main.c


Solution

  • The issue was resolved. The extension of the main was .cu and the which it was directly calling were in .c extensions. So i also changed the extension of those files to .cu and it worked.