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

Author Topic: Can't compile SFML with cmake (linux)  (Read 11119 times)

0 Members and 1 Guest are viewing this topic.

lazeriux

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Can't compile SFML with cmake (linux)
« Reply #15 on: May 03, 2013, 09:06:55 pm »
is there another way to install sfml? :( (without cmake)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Can't compile SFML with cmake (linux)
« Reply #16 on: May 03, 2013, 09:10:32 pm »
is there another way to install sfml? (without cmake)
Laurent just explained that: Download the official binaries from the SFML hompage.

The dependencies still need to be installed, though.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

lazeriux

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Can't compile SFML with cmake (linux)
« Reply #17 on: May 03, 2013, 10:15:08 pm »
Errors which I get when I have installed sfml from repository

code:
Code: [Select]
#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;
}

Compiler log:
Quote
g++ -Wall -o "omg" "omg.cpp" -lsfml-audio -lsfml-graphics -lsfml-window -lsfml-system (in directory: /home/ares/Desktop)
omg.cpp: In function ‘int main()’:
omg.cpp:6:5: error: ‘CircleShape’ is not a member of ‘sf’
omg.cpp:6:21: error: expected ‘;’ before ‘shape’
omg.cpp:7:5: error: ‘shape’ was not declared in this scope
omg.cpp:9:19: error: ‘class sf::RenderWindow’ has no member named ‘isOpen’
omg.cpp:12:23: error: ‘class sf::RenderWindow’ has no member named ‘pollEvent’
omg.cpp:14:23: error: ‘class sf::Event’ has no member named ‘type’
omg.cpp:15:24: error: ‘class sf::RenderWindow’ has no member named ‘close’
omg.cpp:18:16: error: ‘class sf::RenderWindow’ has no member named ‘clear’
omg.cpp:19:16: error: ‘class sf::RenderWindow’ has no member named ‘draw’
omg.cpp:20:16: error: ‘class sf::RenderWindow’ has no member named ‘display’
Compilation failed.


Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Can't compile SFML with cmake (linux)
« Reply #18 on: May 03, 2013, 10:17:54 pm »
You installed SFML 1.6.

You must go to the Download section of the SFML website and get there what you want (2.0, Linux).
Laurent Gomila - SFML developer

lazeriux

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Can't compile SFML with cmake (linux)
« Reply #19 on: May 03, 2013, 10:37:18 pm »
But I don't know how to install.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Can't compile SFML with cmake (linux)
« Reply #20 on: May 03, 2013, 10:46:28 pm »
There are also tutorials on the website. And it's just headers and libs to copy, there's nothing to "install".
Laurent Gomila - SFML developer

lazeriux

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Can't compile SFML with cmake (linux)
« Reply #21 on: May 03, 2013, 11:04:06 pm »
But I don't understand where I should pute those libs and headers

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Can't compile SFML with cmake (linux)
« Reply #22 on: May 04, 2013, 08:06:54 am »
Wherever you want. Either in /usr/local, or in /home/....

If you don't put it in a standard path:
- add -Isfml/include to the compiler flags
- add -Lsfml/lib to the linker flags
- add sfml/lib to LD_LIBRARY_PATH before launching your app
Laurent Gomila - SFML developer