You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compiler report an undefined reference error. It was seeking Action1 for initial event and State1.
undefined reference to `void Action1::operator()<boost::ext::sml::v1_1_6::back::initial>(boost::ext::sml::v1_1_6::back::initial const&, State1&) const'
But idle state has no on_entry defined.
Even we want one, shouldn't the default be void SomeAction::operator()<boost::ext::sml::v1_1_6::back::initial>(boost::ext::sml::v1_1_6::back::initial const&, StateIdle&) const
?
sm.h:
#pragma once
#include <boost/sml.hpp>
namespace sml = boost::sml;
struct next {};
struct State1{int i;
};
struct Action1{
void operator()(const auto &evt, State1 & s)const;
};
struct hello_world {
auto operator()() const {
using namespace sml;
return make_transition_table(
*"idle"_s + event<next> = state<State1>,
state<State1> + sml::on_entry<_> /Action1(),
state<State1> + event<next> = X
);
}
};
$ g++ -std=c++20 main.cpp sm.cpp
D:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
D:\msys64\tmp\ccqXGsRK.o:main.cpp:(.text$_ZN5boost3ext3sml6v1_1_65front4callINS2_4back8on_entryINS5
_1_ENS5_7initialEEENS2_3aux9type_listIJRKS8_R6State1EEENS5_9no_policyEE7executeINSA_12zero_wrapperI7
Action1vEENS5_7sm_implINS5_9sm_policyI11hello_worldJEEEEENSA_4poolIJSF_EEENSS_IJSR_EEEEEDaT_RKS9_RT0
_RT1_RT2_[_ZN5boost3ext3sml6v1_1_65front4callINS2_4back8on_entryINS5_1_ENS5_7initialEEENS2_3aux9type
_listIJRKS8_R6State1EEENS5_9no_policyEE7executeINSA_12zero_wrapperI7Action1vEENS5_7sm_implINS5_9sm_p
olicyI11hello_worldJEEEEENSA_4poolIJSF_EEENSS_IJSR_EEEEEDaT_RKS9_RT0_RT1_RT2_]+0x61): undefined refe
rence to `void Action1::operator()<boost::ext::sml::v1_1_6::back::initial>(boost::ext::sml::v1_1_6::
back::initial const&, State1&) const'
collect2.exe: error: ld returned 1 exit status
The text was updated successfully, but these errors were encountered:
stirwl
changed the title
template instantiate issue: struct action with event and state as parameter is complant can't find reference if the action is defined in standalone cpp
Wrong Action is instantiated and called for initial event
Mar 13, 2023
Compiler report an undefined reference error. It was seeking Action1 for initial event and State1.
But idle state has no on_entry defined.
Even we want one, shouldn't the default be
void SomeAction::operator()<boost::ext::sml::v1_1_6::back::initial>(boost::ext::sml::v1_1_6::back::initial const&, StateIdle&) const
?
sm.h:
sm.cpp:
main.cpp:
sm.zip
Error msg:
The text was updated successfully, but these errors were encountered: