0

I'm trying to get SFML working on LinuxMint 18, the Cinnamon version, but I get a segmentation fault, whenever I use sf::RenderWindow.

I installed SFML 2.4.2 by downloading the 64-bit Linux Version from the official website, as sudo apt-get install libsfml-dev strangely didn't install the libraries.

Using something different, like sf::Clock works perfectly fine. I'm using the code from the SFML website, posted below:

#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;
}

Any suggestions?

EDIT: I'm not running Linux Mint in any Virtual Machine. I'm dualbooting with Windows 10. Also the segmentation fault happens to be an invalid pointer error.

AProgrammer
  • 81
  • 11
  • Run `ldconfig -v` to check if you have sfml's libraries in your ld config yet. Then check where are the sfml's `.so` in `/usr/lib` or `/usr/local/lib`. If they are in `/usr/local/lib` then follow this instruction to add `/usr/local/lib` to your ld config: http://stackoverflow.com/a/13428971/2683574 – tnt Mar 19 '17 at 21:52
  • And what if they are in /usr/lib? Because that's where I put them. I don't have much time right now to test "ldconfig -v", but I can tell you that they are in /usr/lib. – AProgrammer Mar 20 '17 at 20:02
  • Try running `sudo ldconfig` then. – tnt Mar 20 '17 at 20:58
  • I've done that now, but I'm still getting a segmentation fault. In case it helps - it's an invalid pointer error. – AProgrammer Mar 22 '17 at 16:09
  • I'm getting the same problem. Did the same steps as @AProgrammer. Does it change anything if I'm on Virtual Box? – Dan Mar 23 '18 at 20:35
  • Yes, it does, that's why I edited my question. I don't remember the website I read that though :/ – AProgrammer Apr 03 '18 at 18:37

0 Answers0