0

Im trying to use the SFML library in Visual Studio 2019. Ended up having that error. I created binary files using source code and cmake which was set defaulted to x64 generator. I followed and linked all the libraries and dependencies.

I even followed this and couldn't get to resolve the issue

#include <SFML/Graphics.hpp>
int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}


I'm new to the VS and programming. Any help especially noob friendly would be appreciated

zeneks
  • 3
  • 1

1 Answers1

0

The error is caused by you trying to mix 32 bit and 64 bit files. If your project is 64 bit (x64), you'll also need a 64 bit of SFML (and all other dependencies). Same is true for 32 bit (x86).

Mario
  • 35,726
  • 5
  • 62
  • 78
  • While making binary files the cmake generator was set to x64 so my files are x64 bit if im not wrong? What should i do then? Build new files keeping generator set to x84? – zeneks Nov 19 '19 at 06:03
  • @zeneks That depends on you. You can use either on 64 bit Windows, you just have to use the same architecture for SFML and your own program. – Mario Nov 19 '19 at 07:49
  • i downloaded the 64 bit version of SFML libraries and it worked. – zeneks Nov 19 '19 at 11:50