SFML community forums

Help => General => Topic started by: LedLoaf on February 08, 2021, 02:58:47 am

Title: Problems with x64
Post by: LedLoaf on February 08, 2021, 02:58:47 am
Hello,

So I've been trying to use the 2.5.1 x64 version and coming across these errors every time

 error C2589: '(': illegal token on right side of '::'
error C2589: '(': illegal token on right side of '::'
 

Which points to:
Rect.inl
////////////////////////////////////////////////////////////
template <typename T>
bool Rect<T>::contains(T x, T y) const
{
    // Rectangles with negative dimensions are allowed, so we must handle them correctly

    // Compute the real min and max of the rectangle on both axes
    T minX = std::min(left, static_cast<T>(left + width));
    T maxX = std::max(left, static_cast<T>(left + width));
    T minY = std::min(top, static_cast<T>(top + height));
    T maxY = std::max(top, static_cast<T>(top + height));

    return (x >= minX) && (x < maxX) && (y >= minY) && (y < maxY);
}

It's weird to me because the x86 version works just fine, as soon as I switch to the 64 it does this. It's the exact same, except for the x64 for x32 linked. I'll also point out that I'm linking statically. I don't remember ever having this problem before, so I must be doing something stupid.

Thanks

Title: Re: Problems with x64
Post by: LedLoaf on February 08, 2021, 03:11:46 am
You can delete this, I'm not sure what happened, but I just redid everything and it worked.
Title: Re: Problems with x64
Post by: Laurent on February 08, 2021, 07:58:05 am
It happens when you include <Windows.h> before SFML headers. It contains "min" and "max" macros, which totally ruin this kind of code using std::min and std::max. The solution is to define the "NOMINMAX" preprocessor symbol in your project.