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

Author Topic: [SOLVED] Error: 'sf::Vector2<T>::UnitX': redefinition; different storage class  (Read 2569 times)

0 Members and 2 Guests are viewing this topic.

sfmlearner

  • Newbie
  • *
  • Posts: 9
    • View Profile
Hello,

I've been trying to setup a project with SFML but I can't compile the tutorial, I followed the steps carefully, tried debug, release, static, non-static, etc... But Im still getting this error when I try to compile:

Output:
Build started...
1>------ Build started: Project: 04-hello-sfml, Configuration: Debug x64 ------
1>main.cpp
1>C:\Users\pc2\Documents\sfml\include\SFML\System\Vector2.inl(291,34): error C2370: 'sf::Vector2<T>::UnitX': redefinition; different storage class
1>C:\Users\pc2\Documents\sfml\include\SFML\System\Vector2.hpp(204): message : see declaration of 'sf::Vector2<T>::UnitX'
1>C:\Users\pc2\Documents\sfml\include\SFML\System\Vector2.inl(294,34): error C2370: 'sf::Vector2<T>::UnitY': redefinition; different storage class
1>C:\Users\pc2\Documents\sfml\include\SFML\System\Vector2.hpp(205): message : see declaration of 'sf::Vector2<T>::UnitY'
1>Done building project "04-hello-sfml.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

The code that im trying to compile is the tutorial one https://www.sfml-dev.org/tutorials/2.5/start-vc.php. Im including only SFML/Graphics.hpp

Also, when I go into Vector2.inl to see what's going on, the IDE is throwing a lot of errors like "Vector2 is not a template", "name followed by '::' must be a class or namespace name", etc... Maybe the problem is the compiler or the C++ version, I don't know.

IDE: Visual Studio 2022
SFML version: Last one from Snapshots (windows-vc17-64.zip), I don't know how to see the version
IDE C++ Language Standard: ISO C++20 Standard
Compiler: Microsoft (R) C/C++ Optimizing Compiler Version 19.31.31105 for x86
« Last Edit: April 12, 2022, 02:41:10 pm by sfmlearner »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Error: 'sf::Vector2<T>::UnitX': redefinition; different storage class
« Reply #1 on: April 12, 2022, 01:40:05 pm »
It's a regression/bug (see here). The workaround are to either set /permissive, revert back to a version before the introduced change or using the more stable 2.6.x branch.

Change it to No (i.e. not like in the image below)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

sfmlearner

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Error: 'sf::Vector2<T>::UnitX': redefinition; different storage class
« Reply #2 on: April 12, 2022, 01:55:50 pm »
Oh, I didn't saw the bug already reported on github.

Where is the option to change the Conformance mode? I went to Project > Properties but i couldn't find it.



Thanks

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Error: 'sf::Vector2<T>::UnitX': redefinition; different storage class
« Reply #3 on: April 12, 2022, 02:05:24 pm »
Ah, it's under C/C++ > Language or similar

You can also use the search above in said dialog to find it
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

sfmlearner

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Error: 'sf::Vector2<T>::UnitX': redefinition; different storage class
« Reply #4 on: April 12, 2022, 02:40:45 pm »
TYSM! It's finally working  :)