from what I understand regarding the CUDA compile chain, the front-end (cudafe) is supposed to separate host from device code that is encoded into a single .cu file. To digg down some linker errors I was getting, I took a pure .cpp file (no CUDA code inside) with implementations of class methods, renamed that file to *.cu and added the following custom build step to it in Visual Studio:
"$(CUDA_BIN_PATH)\nvcc.exe" -ccbin "$(VCInstallDir)bin" -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MTd -I"$(CUDA_INC_PATH)" -I./ -I../../common/inc -I"$(DXSDK_DIR)\Include" -Xcudafe --diag_suppress=unsigned_compare_with_negative -o $(ConfigurationName)\$(InputName).obj $(InputName).cu
with “Outputs” set to
When I compile and link this file, I get linker errors because none of the C++ class methods implemented in that file are found. It seems cudafe does not correctly pass the code to cl.exe to compile the C++ code. What am I missing here?