Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [SOLVED] Fail to Build with Error C2589 in Rect.inl  (Read 4389 times)

0 Members and 1 Guest are viewing this topic.

keishimon

  • Newbie
  • *
  • Posts: 2
    • View Profile
[SOLVED] Fail to Build with Error C2589 in Rect.inl
« on: November 01, 2019, 06:19:55 am »
I fail to build my VS solution with compile error C2589 in Rect.inl.
Someone please guide me how to fix.

The only two error messages when I try to build are follows :
C:\SFML\SFML-2.5.1\include\SFML\Graphics\Rect.inl(81,19): error C2589: '(': illegal token on right side of '::'.
C:\SFML\SFML-2.5.1\include\SFML\Graphics\Rect.inl(114,21): error C2589: '(': illegal token on right side of '::'

I use Visual Vtudio 2019 Community Edition and SFML 2.5.1 static ver.
I have set up following this tutorial https://www.sfml-dev.org/tutorials/2.5/start-vc.php and successfully compiled and ran the test code.

I include <SFML/Graphics.hpp>, declare using namespace sf; and use classes RenderWindow, VideoMode, Texture, Sprite, IntRect, Clock, Event, and Keyboard (I might overlook though).
« Last Edit: November 01, 2019, 09:19:58 am by keishimon »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11008
    • View Profile
    • development blog
    • Email
Re: Fail to Build with Error C2589 in Rect.inl
« Reply #1 on: November 01, 2019, 07:26:59 am »
Did you include windows.h? If so, you need to first define NOMINMAX, so the header doesn't define min/max macros, destroying every usage of std::min/std::max.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

keishimon

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: [SOLVED] Fail to Build with Error C2589 in Rect.inl
« Reply #2 on: November 01, 2019, 09:20:55 am »
Thank you!
As you mentioned #define NOMINMAX prior to windows.h fixed the compiler error :)

 

anything