Reputation: 151
I'm a beginning C++ programmer that is currently using SFML. I use Eclipse CDT with MinGW GCC, and I'm trying to create a basic window using the source code found at http://sfml-dev.org/tutorials/2.1/start-cb.php. I put the code in, and apparently it doesn't work. I tried including the libraries, linker paths, include paths, include files, and everything, but it just doesn't seem to work for me.
Code:
#include <SFML\Graphics.hpp>
#include <SFML\Window.hpp>
#include <SFML\System.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(640, 480), "SFML Application");
sf::CircleShape shape;
shape.setRadius(40.f);
shape.setPosition(100.f, 100.f);
shape.setFillColor(sf::Color::Cyan);
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();
}
}
My console is giving me errors such as "'window' not defined in this scope", "'shape' not defined in this scope", "expected ; before 'shape'", etc.
Does anyone know why, and can anyone help me?
Upvotes: 0
Views: 714
Reputation: 871
I suggest you try first something like this:
#include <SFML\System.hpp>
int main()
{return 0;}
just to make sure that the include path is set properly.
Then you can try to set the library path, link the system module library and use some class from it.
Then you can try to use the other modules as well, make sure to link them in the correct order, see "getting started with SFML"
Upvotes: 1