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

Author Topic: Install in Linux  (Read 1404 times)

0 Members and 1 Guest are viewing this topic.

Pein95

  • Newbie
  • *
  • Posts: 4
    • View Profile
Install in Linux
« on: December 14, 2013, 06:26:56 pm »
I try to install sfml in linux mint.
In the terminal I write this line:  sudo apt-get install libsfml-dev
After instalation I try to compile this code:

#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;
}
 
g++ -o main.cpp
And after that I have this errors:
main.cpp: In function ‘int main()’:
main.cpp:6:5: error: ‘CircleShape’ is not a member of ‘sf’
main.cpp:6:21: error: expected ‘;’ before ‘shape’
main.cpp:7:5: error: ‘shape’ was not declared in this scope
main.cpp:9:19: error: ‘class sf::RenderWindow’ has no member named ‘isOpen’
main.cpp:12:23: error: ‘class sf::RenderWindow’ has no member named ‘pollEvent’
main.cpp:14:23: error: ‘class sf::Event’ has no member named ‘type’
main.cpp:15:24: error: ‘class sf::RenderWindow’ has no member named ‘close’
main.cpp:18:16: error: ‘class sf::RenderWindow’ has no member named ‘clear’
main.cpp:19:16: error: ‘class sf::RenderWindow’ has no member named ‘draw’
main.cpp:20:16: error: ‘class sf::RenderWindow’ has no member named ‘display’

How I can fix its?
Sorry for my English, it is not very good)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Install in Linux
« Reply #1 on: December 14, 2013, 06:58:18 pm »
Linux Mint, next to Debian or Ubuntu anx other distros have SFML still in the old version 1.6.
You need to compile SFML from source.

Btw the search function would list you quite a few similar posts.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/