[statechart]LNK2001 Error on VC 8.0

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@UEvReset@@@ detail@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@UEvStartStop@@@ detail@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.

Hi Jiang Jiang Miao <jiangfriend <at> gmail.com> writes:
Here is a tutorial. I compile succeeded at DEBUG mode, but failed at RELEASE mode. And I got LNK2001 Error.
It surely looks like compiler/linker bug, as the same works just fine under MSVC7.1. This problem has been reported before: <http://thread.gmane.org/gmane.comp.lib.boost.user/23065> Please try the workaround mentioned in the post and let me know whether it works for you. HTH, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

Andreas Huber,Thank you for your help. I have solve the problem.I compared between debug mode and release mode. I add flag /Gm(Enable Minimal Rebuild) in release mode. It is compiled succeeded. But I don't know the reason.
participants (3)
-
Andreas Huber
-
Jiang Miao
-
JiangMiao