ComputeCpp 2.1.0 breaks after update to VS2019 16.7

After updating to VS2019 v16.7, a project based on ComputeCpp 2.1.0 that previously worked fine shows a pile of compile error in various standard library headers. One of the errors, for example, is caused by the symbol _HAS_CONDITIONAL_EXPLICIT being defined but then the compiler not accepting an “explicit(…)” attribute within the '#ifdef’ed region.

My suspicion is that there is a conflict between the compiler installed with ComputeCpp and the compiler&library versions installed by visual studio.

I did have a similar problem already when updating to an earlier version of VS. Back then I could work around by hacking one of the header files. This time it seems more complex.

Unfortunately, Visual Studio Community does not offer a means to roll back to an older version, so this is actually a blocker issue on my machine.

After some more poking around, I found one workaround:

In ComputeCppCompilerChecks.cmake from the computecpp-sdk I added “-D__CUDACC__” right after the argument “-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH” (in both placed, once for the check, another time for adding it to COMPUTECPP_DEVICE_COMPILER_FLAGS

As it turns out the standard headers delivered with VS2019 16.7 check for the symbol __CUDACC__ exactly for those language features causing problems with the ComputeCpp compiler.

Thanks for reporting this, and for finding the workaround. VS has updated their headers version which we will also need to update. We’ll update this but in the meantime does the workaround solve the problem for you temporarily?

Indeed, the workaround solves my problem.

It turns out this is a problem with the MSVC Toolset Version v14.27. v14.26 works as expected, without the need for this workaround. Please check the solution in this post for more information