Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Halp Computer (stop all the list iterator)

Name: Anonymous 2009-03-22 2:50

Hey guys, harassing you for a simple reason: we're both pretty bored, I'm coding, and I hit a problem that google doesn't want to give its secrets for.
I'm making a game as a final project for this semester in C++, and I have a class "Actor" defined that is the root class for the "enemy", "sprite" and all other classes - essientially, it's a bitmap (i'm using Allegro) in an object with useful functions. I have a game engine which hold a list to pointers to all these objects, a list of Actors*. However, when I attempt to iterate through the list, on decleration of my iterator, g++ tells me,
"Engine.h:48: error: no match for call to '(std::list<Actor*, std::allocator<Actor*> >) (std::_List_iterator<Actor*>&)'
"
The line of code is "list<Actor*>::iterator pos = gameObjects.begin();"

So, any ideas?

Also, I am not a bbcode expert.

Name: Anonymous 2009-03-22 8:50

The forward reference

class Actor; //solves a circular dependancy (sic)

comes after the inclusion of Actor.h -- was this intentional?

Putting this into VC++, clearing out the header files I don't have in favour of

class Actor {
public:
    void update();
};
class BITMAP;


I get

1>c:\users\######\documents\visual studio 2008\projects\dummy\cppscratch[spoiler]prog[/spoiler].cpp(44) : error C2839: invalid return type 'Actor **' for overloaded 'operator ->'
1>c:\users\######\documents\visual studio 2008\projects\dummy\cppscratch[spoiler]prog[/spoiler].cpp(44) : error C2039: 'update' : is not a member of 'std::list<_Ty>::_Iterator<_Secure_validation>'
1>        with
1>        [
1>            _Ty=Actor *
1>        ]
1>        and
1>        [
1>            _Secure_validation=true
1>        ]

referring to this line

            pos->update();

The first of which indicates a problem, maybe even the same one the gay g++ message is talking about.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List