0

This is rather bizarre, I have a class I've been building and currently I have this at the top of my file:

#pragma once
#include <cstdint>
#include <cstring>
#include <string>
#include <limits>

Now I need to add windows.h to the mix but as soon as I do that, I get "Error: expected an identifier" on this line:

inline uint32_t Hash2(std::string &Key) {
    return (MurMur3::x86_32(Key.c_str(), Key.size(), 2) % (std::numeric_limits<uint32_t>::max() - 1)) + 1;
}

the red line appears under the ::max if that matters. As for the function itself, its supposed to use murmur3 to get me a hash that isn't 0.

If I remove

std::numeric_limits<uint32_t>::max()

and replace it with the constant 4294967295

then it works fine again.

I don't understand why this is happening. Does anybody have a clue?

user81993
  • 6,167
  • 6
  • 32
  • 64

1 Answers1

0

Windows.h has a very bad habbit of defining macros in it. In particular, it defines min and max. You need to undef those.

SergeyA
  • 61,605
  • 5
  • 78
  • 137