Boost logo

Boost Users :

Subject: [Boost-users] [StateChart] How to fix "the outer state does not have inner states."
From: Zhu Bicen (zhubicen_at_[hidden])
Date: 2011-12-08 02:48:31


Following code can NOT be compiled successfully, according the comment in
boost source code I note that the compiler complains the outer state does
not have inner state. I want to know how to indicate one state have a inner
state, if it didn't have a initial state? Thanks!

#include <boost/statechart/state_machine.hpp>
#include <boost/statechart/state.hpp>
namespace fsm = boost::statechart;
class HandlingFileState;
class PlayerFsm : public fsm::state_machine< PlayerFsm, HandlingFileState >
{};

class HandlingFileState: public fsm::state< HandlingFileState, PlayerFsm/*,
PlayingState*/>
//if the initial state is uncoment, it can be compiled success. But I don't
want this.
{};

class NormalPlayingState;
class PlayingState: public fsm::state< PlayingState, HandlingFileState,
NormalPlayingState >
{};

class NormalPlayingState: public fsm::state< NormalPlayingState,
PlayingState>
{};

int main()
{
    PlayerFsm fsm;
}

------ Build started: Project: TestFsm, Configuration: Debug Win32 ------
Compiling...
test_fsm.cpp
d:\3rd_lib\boost_1_46_1\include\boost-1_46_1\boost\statechart\simple_state.hpp(387)
: error C2027: use of undefined type 'boost::STATIC_ASSERTION_FAILURE<x>'
        with
        [
            x=false
        ]

d:\3rd_lib\boost_1_46_1\include\boost-1_46_1\boost\statechart\state.hpp(30)
: see reference to class template instantiation
'boost::statechart::simple_state<MostDerived,Context,InnerInitial,historyMode>'
being compiled
        with
        [
            MostDerived=PlayingState,
            Context=HandlingFileState,
            InnerInitial=NormalPlayingState,
            historyMode=has_no_history
        ]
        d:\bzhu\code\trunk\testfsm\test_fsm.cpp(16) : see reference to
class template instantiation
'boost::statechart::state<MostDerived,Context,InnerInitial>' being compiled
        with
        [
            MostDerived=PlayingState,
            Context=HandlingFileState,
            InnerInitial=NormalPlayingState
        ]
Build log was saved at
"file://d:\bzhu\Code\trunk\TestFsm\Debug\BuildLog.htm"
TestFsm - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

and the first error point to :

    // If you receive a
    // "use of undefined type 'boost::STATIC_ASSERTION_FAILURE<x>'" or
similar
    // compiler error here then either this state resides in a non-existent
    // orthogonal region of the outer state or the outer state does not have
    // inner states.
    BOOST_STATIC_ASSERT( ( mpl::less<
      orthogonal_position,
      typename context_type::no_of_orthogonal_regions >::value ) );



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net