Boost logo

Boost :

Subject: [boost] [statechart] Undefined type
From: s_a_white_at_[hidden]
Date: 2010-03-11 14:29:23


 

 Hi,

I've inherited some code that currently compiles and runs under Linux (gcc 4.2.1) and am looking to switch to Windows using the vs 2003 with SP1.

Unfortunately the code fails to compile with undefined symbols. An example of the code is as follows:

#include <boost/statechart/event.hpp>
#include <boost/statechart/state_machine.hpp>
#include <boost/statechart/simple_state.hpp>
#include <boost/statechart/transition.hpp>

#include <iostream>

namespace sc = boost::statechart;

struct EvStartStop : sc::event< EvStartStop > {};
struct EvReset : sc::event< EvReset > {};

struct Active;
struct Stopped;
struct Running;

struct StopWatch : sc::state_machine< StopWatch, Active > {};

struct Active : sc::simple_state< Active, StopWatch, Stopped >
{
  typedef sc::transition< EvReset, Active > reactions;
};

struct Stopped : sc::simple_state< Stopped, Active >
{
  typedef sc::transition< EvStartStop, Running > reactions;
};

int main()
{
  return 0;
}

I'm aware that the code is incomplete as Running is only forward declared. It is provided this way since the real model under Linux is broken up across multiple headers rather than all being in one header.

Under Linux the above code compiles without an issue but vs 2003 complains about Running being undefined. Removing sc::transition< EvStartStop, Running > makes the compilation problem disappear. A similiar issue exists for Windows if Running was defined but uses an inner state that was only foward declared. Again Linux seems to have no problems.

For vs 2003 wrapping the reactions or inner state with mpl::list<> does not fix the problem.

Can anyone suggest if what is being done here is broken under vs 2003, or should not be allowed under gcc? Are there workarounds for the boost headers for vs 2003 or recommendations to allow splitting the state machine across multiple headers?

Best Regards,
Simon


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk