Visual studio 2019 CUDA source file header dependency issue

Hi. I’m using visual studio 2019 on windows 10 with CUDA 11.0.

The problem is when I compile “.cu” extension files that include some header files.
If the included header files are changed, cu files cannot detect the changes and they are not recompiled.
For example, if I have the following header and source respectively:

// header.h
class my_class
{
public:
  int a;
};
// source.cu
#include "header.h"

int main()
{
  my_class A;
  return 0;
}

the first compilation is done.
Then, if I change “header.h” to this,

// header.h
class my_class
{
public:
  int a;
  int b; // This one is added.
};

and pressing the build button (ctrl+shfit+B) does not compile “source.cu”, even though it has obvious dependency with the header file.
I have searched the forum for some time, but I cannot find this issue is reported.
How can I resolve this?

1 Like

similar problem seen in linux environment