Sign in to follow this  
Aliii

Weird C++ problem

Recommended Posts

Aliii    1456

Here is this piece of code:

    for( list<CObjectParent*>::const_iterator i = object_parent_list.begin(); i != object_parent_list.end(); ++i)
        if( (*i)->select( cam_pos, curs_pos, &min_distance, &p_aimed_object))
            aimed_something = true;

This shouldnt compile because CObjectParent.select(...) is not const. But it works.

Also the debugger is being weird. I run the program in debug mode, it works as it should(more or less) but when I stop it at a random breakpoint and i step through a few lines it gives weird errors.

 

[attachment=16427:Untitled.png]

 

See the pic. It said this to the PushMatrix line: "Type std::list<CObjectInstance*, std::allocator<CObjectInstance*> > has no component named object_instance_list."

Sometimes it says segmentation fault bla-bla. Ive been checking the code all day but everything seems to be OK. Help would be really appreciated.

My IDE is NetBeans and the compiler is GCC(using the C++11 standard)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this