
Serena Fritsch wrote:
Hi All, Apologies if there are multiple psoting of this message. I want to use the boost::statechart library. However i encountered a small problem with using the orthogonal regions. In the statechart tutorial, every class declaration is put into one file, however i would like to put each class declaration into separate files. [code & error snipped]
The ultimate problem lies in in Main.cpp (received by private email): <original_code> #include "Machine.h" #include "C.h" #include <iostream> namespace sc = boost::statechart; int main(){ Machine machine; machine.initiate(); machine.displayStateConfiguration(machine); return 0; } </original_code> At the point of initiate() only one part of the initial state configuration is known (C and A). B is missing (which MSVC duly reports with an appropriate error message). Adding the following include to Main.cpp solves the problem: #include "B.h" For more information please see: <http://www.boost-consulting.com/boost/libs/statechart/doc/faq.html#HideInnerWorkings> This item says that the *initial state* must be known at the point of calling initiate() but it should more correctly say that the *initial state configuration* must be known at the point where initiate is called. That is, in addition to the state passed as InitialState to state_machine, all its direct and indirect inner states must also be known. There are ways to enhance encapsulation by means of custom_reactions (which probably need to be triggered by posting internal events in your case), please see: <http://www.boost-consulting.com/boost/libs/statechart/doc/tutorial.html#SpreadingAStateMachineOverMultipleTranslationUnits> HTH, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.