How can I setup Visual Studio 2017 to properly recognize the Cuda code in the Optix project

269 views Asked by At

I try to get into the Optix projects and I have a problem with recognizing the Cuda code in the Visual Studio 2017. I can build and execute the code (even the code in the .cu files), but variables and functions in .cu files, are marked as not recognized (are colored red). Is it possible to fix this issue?

1

There are 1 answers

0
Barrnet Chou On

Because the cuda program is compiled with nvcc.exe (it can be simply understood as c compilation). If the .cpp file contains the .cu file, the .cu file will be compiled with the c++ compiler. I suggest that you could add extern "C" in front of the functions which is called in the .cu file.