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

Author Topic: 'class sf::Window' has no member named 'Member' error  (Read 9720 times)

0 Members and 1 Guest are viewing this topic.

Princessjinifer

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
'class sf::Window' has no member named 'Member' error
« on: April 08, 2012, 06:22:27 am »
With "#include SFML\Window.hpp"
Code: [Select]
'class sf::Window' has no member named 'IsOpened'
'class sf::Window' has no member named 'PollEvent'
'class sf::Window' has no member named 'Close'
'class sf::Window' has no member named 'Display'

With "#include SFML\Graphics.hpp"
Code: [Select]
'class sf::RenderWindow' has no member named 'IsOpened'
'class sf::RenderWindow' has no member named 'PollEvent'
'class sf::RenderWindow' has no member named 'Close'
'class sf::RenderWindow' has no member named 'Display'

The errors above are the 4 errors I get when trying to compile my program.. I have been talking with someone who knows about SFML and I have him stumped too. Does anyone here have any ideas for fixes?

This is the source code:

Code: [Select]
#include <iostream>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

int main() {
sf::Window FollowCursor(sf::VideoMode(800, 600, 32), "Follow Cursor - SFML Window");

while (FollowCursor.IsOpened()) {
sf::Event FCEvent;
while (FollowCursor.PollEvent(FCEvent)) {
if (FCEvent.Type == sf::Event::Closed) {
FollowCursor.Close();
}
}

FollowCursor.Display();
}

return EXIT_SUCCESS;
}

Thanks in advance! :)
-Princessjinifer

EDIT: I fixed them... Nevermind.  I looked at http://www.sfml-dev.org/documentation/2.0/ and it showed that IsOpened is actually isOpen, and PollEvent is pollEvent.. so on and so forth.. So, here is the corrected code:

Code: [Select]
#include <iostream>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

int main() {
sf::Window FollowCursor(sf::VideoMode(800, 600, 32), "Follow Cursor - SFML Window");

while (FollowCursor.isOpen()) {
sf::Event FCEvent;
while (FollowCursor.pollEvent(FCEvent)) {
if (FCEvent.type == sf::Event::Closed) {
FollowCursor.close();
}
}

FollowCursor.display();
}

return EXIT_SUCCESS;
}
« Last Edit: April 08, 2012, 06:29:40 am by Princessjinifer »

Tex Killer

  • Full Member
  • ***
  • Posts: 242
    • View Profile
Re: 'class sf::Window' has no member named 'Member' error
« Reply #1 on: April 08, 2012, 06:28:56 am »
You are probably using a recent SFML2, wich name convention changed to camelCase for member functions.

Display, for example, should now be display, and IsOpened changed to isOpen.

For precise information, read the documentation:
http://www.sfml-dev.org/documentation/2.0/classsf_1_1RenderWindow.php

Princessjinifer

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: 'class sf::Window' has no member named 'Member' error
« Reply #2 on: April 08, 2012, 06:30:29 am »
You are probably using a recent SFML2, wich name convention changed to camelCase for member functions.

Display, for example, should now be display, and IsOpened changed to isOpen.

For precise information, read the documentation:
http://www.sfml-dev.org/documentation/2.0/classsf_1_1RenderWindow.php

Read the edit on my original post, I got it all figured out within minutes of posting this. Even though I have been trying to figure it out for the last two days.

Tex Killer

  • Full Member
  • ***
  • Posts: 242
    • View Profile
Re: 'class sf::Window' has no member named 'Member' error
« Reply #3 on: April 08, 2012, 07:08:29 am »
Ok, glad you solved your problem.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: 'class sf::Window' has no member named 'Member' error
« Reply #4 on: April 08, 2012, 08:37:28 am »
Two days? The first thing you should ever do when you get an "unknown function name" error, is to check in the header or documentation if the function actually exists ;)
Laurent Gomila - SFML developer

 

anything