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

Author Topic: 'x' does not have a class type  (Read 3353 times)

0 Members and 1 Guest are viewing this topic.

carton83

  • Newbie
  • *
  • Posts: 38
    • View Profile
'x' does not have a class type
« on: January 18, 2014, 02:49:42 am »
I'm trying to write a simple function that moves a sprite forward if cetain conditions are met.  I've striped out everything unrelated to my problem and simplified the logic.  I know what is causing the issue and it's a lack of knowledge, but I can't find anything that definatevly explains what I am doing wrong.  So I'm hoping you guys can help.


void moveForward(sf::RectangleShape &person)
{
    if(person.getPosition.x >= 1)
    {
        //Other code
    }
}

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: 'x' does not have a class type
« Reply #1 on: January 18, 2014, 03:08:54 am »
 
void moveForward(sf::RectangleShape &person)
{
    if(person.getPosition().x >= 1)
    {
        //Other code
    }
}


You forgot the parentheses :) . Because you are calling a function and not trying to acces a public variable.


AlexAUT
« Last Edit: January 18, 2014, 03:11:13 am by AlexAUT »

carton83

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: 'x' does not have a class type
« Reply #2 on: January 18, 2014, 03:33:53 am »
Ah, thanks.  I should have caught that.

I wish GCC's error message where a bit more readable.  I shouldn't have to learn another, non-programming language just to understand GCC's messages.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: 'x' does not have a class type
« Reply #3 on: January 18, 2014, 03:38:20 am »
I wish GCC's error message where a bit more readable.  I shouldn't have to learn another, non-programming language just to understand GCC's messages.

Welcome to the world of C++ compiler errors  ;)

(it gets better when you are trying to help someone that is using a compiler in a language you don't even speak)
« Last Edit: January 18, 2014, 04:17:26 am by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

dabbertorres

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • website/blog
Re: 'x' does not have a class type
« Reply #4 on: January 18, 2014, 04:01:56 am »
Ah, thanks.  I should have caught that.

I wish GCC's error message where a bit more readable.  I shouldn't have to learn another, non-programming language just to understand GCC's messages.
You could try using clang. It is known to have much more informative errors than MSVC/GCC. Though it doesn't optimize as well (at least older versions used to, it may have changed). I've known several people to use clang when developing, and then switching to gcc when wanting to release.

 

anything