[Cuda 8, Win 10] error C2137: empty character constant

Hi,

I’m trying to set-up a brand new computer to compile our software. We’re already compiling it on various computers without problems, but the latest one refuses to compile. We end up with this error in every file that includes thrust:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include\thrust/detail/integer_traits.h(68): error C2137: empty character constant

We’re still using Cuda 8.0 and have no plan to update it soon. We’ve checked everything possible and reinstalled our tools a few times (even reset Windows), always with the same result. We’ve even mounted the drive on another computer and were able to compile “remotely”, suggesting a problem on the new machine (too new graphic card? It’s a Quadro P2200). We’re out of ideas. Any help would be welcome!

I’ve created a minimal app that reproduces the problem. Can’t easily upload it due to file extension limitations but find it below.

“Old” machine: compiles without problem
“New” machine: the above mentioned problem appears (see Compilation.txt)

test.h contains

#pragma once

void runCuda();

test.cu contains

#include "test.h"

#include <thrust/device_vector.h>

void runCuda()
{
    thrust::device_ptr<float> d;
}

main.cpp (115 Bytes) CMakeLists.txt (750 Bytes) Compilation.txt (1.6 KB)

Ok, this is getting ridiculous. I trimmed down the code further and I cannot make sense of the results. Here’s the new test.cu (the other files did not change):

#include "test.h"

#undef UCHAR_MAX // Otherwise getting macro redefinition (!)
//#define UCHAR_MAX 0x81 // Any value <= 0x81 (129) works
#define UCHAR_MAX 0x82 // Any value >= 0x82 (130) fails with error C2137

namespace
{

template<unsigned char max_val>
class integer_traits_base
{
  public:
    const unsigned char const_max = max_val;
};

}

void runCuda()
{
    integer_traits_base<UCHAR_MAX> asdf;
}

Even ignoring the fact that UCHAR_MAX is defined without including anything, the point where the problem appears does not make sense. Had the problem started appearing between 0x7f and 0x80 I could have thought that unsigned char may not be unsigned. But 0x81 works when 0x82 generates a C2137?

In case anyone gets this error message, my team finally found the solution !

In the Region settings (Aministrative), there is an option called “beta: use unicode utf-8 for worldwide language support”. It was somehow checked by default. Unchecking it (and rebooting) solved the problem!!

Beta settings|690x455