1
Général / Re : Problème avec objet sf
« le: Novembre 15, 2013, 05:50:27 pm »
Voici les messages d'erreur affiches a la compilation:
> g++ -c main.cpp
main.cpp: In function ‘int main()’:
main.cpp:6:3: error: ‘CircleShape’ is not a member of ‘sf’
main.cpp:6:19: error: expected ‘;’ before ‘shape’
main.cpp:7:3: error: ‘shape’ was not declared in this scope
main.cpp:9:17: error: ‘class sf::RenderWindow’ has no member named ‘isOpen’
main.cpp:13:21: error: ‘class sf::RenderWindow’ has no member named ‘pollEvent’
main.cpp:15:14: error: ‘class sf::Event’ has no member named ‘type’
main.cpp:16:13: error: ‘class sf::RenderWindow’ has no member named ‘close’
main.cpp:18:14: error: ‘class sf::RenderWindow’ has no member named ‘clear’
main.cpp:19:14: error: ‘class sf::RenderWindow’ has no member named ‘draw’
main.cpp:20:14: error: ‘class sf::RenderWindow’ has no member named ‘display’
Voici le code source :
Et j'ai installe la sfml en faisant :
sudo apt-get install libsfml-dev
> g++ -c main.cpp
main.cpp: In function ‘int main()’:
main.cpp:6:3: error: ‘CircleShape’ is not a member of ‘sf’
main.cpp:6:19: error: expected ‘;’ before ‘shape’
main.cpp:7:3: error: ‘shape’ was not declared in this scope
main.cpp:9:17: error: ‘class sf::RenderWindow’ has no member named ‘isOpen’
main.cpp:13:21: error: ‘class sf::RenderWindow’ has no member named ‘pollEvent’
main.cpp:15:14: error: ‘class sf::Event’ has no member named ‘type’
main.cpp:16:13: error: ‘class sf::RenderWindow’ has no member named ‘close’
main.cpp:18:14: error: ‘class sf::RenderWindow’ has no member named ‘clear’
main.cpp:19:14: error: ‘class sf::RenderWindow’ has no member named ‘draw’
main.cpp:20:14: error: ‘class sf::RenderWindow’ has no member named ‘display’
Voici le code source :
#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;
}
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;
}
Et j'ai installe la sfml en faisant :
sudo apt-get install libsfml-dev