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

Author Topic: Compile error: identifier 'Rectangle'  (Read 1468 times)

0 Members and 1 Guest are viewing this topic.

etaiso

  • Newbie
  • *
  • Posts: 3
    • View Profile
Compile error: identifier 'Rectangle'
« 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.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Compile error: identifier 'Rectangle'
« Reply #1 on: March 17, 2012, 09:10:26 am »
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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: