SFML community forums
Help => Graphics => Topic started by: etaiso on March 17, 2012, 01:28:05 am
-
Hi,
I'm having problem compiling any of the shapes from sf::Shape...
when I try to compile the following line:
sf::Shape * _shape = new sf::Shape::Rectangle(v1, v2, sf::Color(0,0,0,255), 0, sf::Color(0,0,0,255));
the compiler (VS2008) says: error C2061: syntax error : identifier 'Rectangle'
I also included:
#pragma comment(lib,"sfml-window-d")
#pragma comment(lib,"sfml-system-d")
#pragma comment(lib,"sfml-main-d")
#pragma comment(lib,"sfml-graphics-d")
#include <SFML/Graphics.hpp>
#include <SFML/Graphics/Shape.hpp>
Any ideas?
Thanks.
-
In SFML 2, there is no static function sf::Shape::Rectangle. Use the class sf::RectangleShape instead (see documentation). And don't use new if you don't need it.
By the way, you're linking only to Debug libraries, this will lead to problems in Release mode. I recommend to link in the project properties, not in code. And <SFML/Graphics.hpp> automatically includes <SFML/Graphics/Shape.hpp>, so the latter is unnecessary.