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

Author Topic: class sf::window has no member named 'Clear'  (Read 11433 times)

0 Members and 1 Guest are viewing this topic.

Cubasy

  • Newbie
  • *
  • Posts: 2
    • View Profile
class sf::window has no member named 'Clear'
« on: July 16, 2011, 02:03:59 am »
I just started C++ this morning, and I've learned very quickly. I decided to use SFML since it looks simple and gets the job done.

I've been able to display a simple window so far, but I've run into a very obscure error that seems like nobody else has ever gotten. Whenever I try to do:
Code: [Select]

App.Clear(sf::Color(200, 0, 0));
App.Display();

at the end of my while(Running) loop, I get an error (class sf::window has no member named 'Clear') ? (I also get an error similar to this when I use PollEvent() )

I followed every word of the setup guide for SFML (I'm using Code::Blocks by the way.) I've copied all of the required DLLs into the project's directory, added the include\ and lib\ directories in Settings/Compiler and Decompiler, put SFML_DYNAMIC in the #defines section..... I'm not sure what I'm doing wrong... :(

Here's my main.cpp code in case I did something wrong in the code itself:
Code: [Select]

#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

#include <iostream>

int main()
{
    sf::Window App(sf::VideoMode(640, 480, 32), "SFML Window");
    sf::Event Event;
    bool running = true;
    while(running)
    {
        while (App.GetEvent(Event))
        {
            if(Event.Type == sf::Event::Closed)
            {
                running = false;
            }
        }
        App.Clear(sf::Color(200,0,0)); // this is what causes the error
        App.Display();
    }
    return EXIT_SUCCESS;
}

TricksterGuy

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
class sf::window has no member named 'Clear'
« Reply #1 on: July 16, 2011, 02:06:04 am »
Code: [Select]
sf::Window App(sf::VideoMode(640, 480, 32), "SFML Window");

needs to be

Code: [Select]
sf::RenderWindow App(sf::VideoMode(640, 480, 32), "SFML Window");

Cubasy

  • Newbie
  • *
  • Posts: 2
    • View Profile
class sf::window has no member named 'Clear'
« Reply #2 on: July 16, 2011, 02:08:03 am »
Quote from: "TricksterGuy"
Code: [Select]
sf::Window App(sf::VideoMode(640, 480, 32), "SFML Window");

needs to be

Code: [Select]
sf::RenderWindow App(sf::VideoMode(640, 480, 32), "SFML Window");

Oh lol thanks a ton!  :D

 

anything