Boost logo

Boost Users :

From: Jiang Miao (jiangfriend_at_[hidden])
Date: 2007-07-23 12:28:34


Here is a tutorial. I compile succeeded at DEBUG mode, but failed at RELEASE
mode. And I got LNK2001 Error.

#include <boost/statechart/event.hpp>
#include <boost/statechart/state_machine.hpp>
#include <boost/statechart/simple_state.hpp>
#include <boost/statechart/transition.hpp>
namespace sc = boost::statechart;

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

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

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

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

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

// A state can define an arbitrary number of reactions. That's
// why we have to put them into an mpl::list<> as soon as there
// is more than one of them
// (see Specifying multiple reactions for a state).

int main()
{
  StopWatch myWatch;
  myWatch.initiate();
  myWatch.process_event( EvStartStop() );
  myWatch.process_event ( EvStartStop() );
  myWatch.process_event( EvStartStop() );
  myWatch.process_event( EvReset() );
  return 0;
}

//Output
Linking...
statechart.obj : error LNK2001: unresolved external symbol "public: void
__thiscall boost::statechart::detail::no_context<struct
EvReset>::no_function(struct EvReset const &)"
(?no_function@?$no_context_at_UEvReset@@@ detail_at_statechart
@boost@@QAEXABUEvReset@@@Z)
statechart.obj : error LNK2001: unresolved external symbol "public: void
__thiscall boost::statechart::detail::no_context<struct
EvStartStop>::no_function(struct EvStartStop const &)"
(?no_function@?$no_context_at_UEvStartStop@@@ detail_at_statechart
@boost@@QAEXABUEvStartStop@@@Z)
i:\programme\test\statechart\Release\statechart.exe : fatal error LNK1120: 2
unresolved externals

How can I solve the problem? Thank you.



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