SFML community forums

Help => General => Topic started by: phufhi on September 09, 2012, 03:51:10 pm

Title: sf::Clock does not work
Post by: phufhi on September 09, 2012, 03:51:10 pm
Recently I got the newest version of SFML 2, but I couldn't get sf::Clock to work.
This code produces the error:
#include <SFML/Graphics.hpp>

int main()
{
    sf::Clock clock();
    sf::Time time = clock.getElapsedTime();

    return 0;
}

The compiler tells me this:
error: request for member 'getElapsedTime' in 'clock', which is of non-class type 'sf::Clock()'

note:
This does also not work with <SFML/System.hpp>
Title: Re: sf::Clock does not work
Post by: eXpl0it3r on September 09, 2012, 03:54:41 pm
Does that work:

#include <SFML/System.hpp>

int main()
{
    sf::Clock clock;
    sf::Time time = clock.getElapsedTime();

    return 0;
}
Title: Re: sf::Clock does not work
Post by: phufhi on September 09, 2012, 03:59:59 pm
Thanks, this works!
I have no idea how I missed this (it's in the documentation and my previous programs)...