Build errors !
-
Hi Guys!, I have been working on Finite state machine based on a well documented tutorial in code project Generic Finite State Machine (FSM)[^] I tried compiling the sample project available with this but can't proceed because of few errors. The project is develped with VS 2010 but I'm using 2012. I'll give the code excerpt where the error points..
struct StateHandlerBase
{
SharedData data;
States state;
Transitions *m_interfaces[static_cast<size_t>(Size)];
StateHandlerBase()
: data(SharedData()),
state(static_cast<States>(InitState))/*, m_interfaces({0})*/
{
}}; typedef int DummyExplicitSpecialization; template <States stateParam, class Dummy=DummyExplicitSpecialization> struct StateHandler : StateHandler<static\_cast<States>(static\_cast<size\_t>(stateParam)-1)> { TransitionImplement<StateMachineComponents, static\_cast<States>(stateParam)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[static\_cast<size\_t>(stateParam)\] = &m\_interface; } }; template <class DummyExplicitSpecialization> struct StateHandler<static\_cast<States>(0), DummyExplicitSpecialization> : StateHandlerBase { TransitionImplement<StateMachineComponents, static\_cast<States>(0)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[0\] = &m\_interface; } }; typedef StateHandler<static\_cast<States>(TerminateState), DummyExplicitSpecialization> StateHanlderType;
StateHanlderType StateHanlderInstance;
These are the errors: error C2976: 'Fsm::StateHandler' : too few template arguments error C3855: 'Fsm::StateHandler': template parameter 'stateParam' is incompatible with the declaration I'm totally stuck!!. I have no idea what is happening Greatly appreciate possible suggestions to get out of this
-
Hi Guys!, I have been working on Finite state machine based on a well documented tutorial in code project Generic Finite State Machine (FSM)[^] I tried compiling the sample project available with this but can't proceed because of few errors. The project is develped with VS 2010 but I'm using 2012. I'll give the code excerpt where the error points..
struct StateHandlerBase
{
SharedData data;
States state;
Transitions *m_interfaces[static_cast<size_t>(Size)];
StateHandlerBase()
: data(SharedData()),
state(static_cast<States>(InitState))/*, m_interfaces({0})*/
{
}}; typedef int DummyExplicitSpecialization; template <States stateParam, class Dummy=DummyExplicitSpecialization> struct StateHandler : StateHandler<static\_cast<States>(static\_cast<size\_t>(stateParam)-1)> { TransitionImplement<StateMachineComponents, static\_cast<States>(stateParam)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[static\_cast<size\_t>(stateParam)\] = &m\_interface; } }; template <class DummyExplicitSpecialization> struct StateHandler<static\_cast<States>(0), DummyExplicitSpecialization> : StateHandlerBase { TransitionImplement<StateMachineComponents, static\_cast<States>(0)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[0\] = &m\_interface; } }; typedef StateHandler<static\_cast<States>(TerminateState), DummyExplicitSpecialization> StateHanlderType;
StateHanlderType StateHanlderInstance;
These are the errors: error C2976: 'Fsm::StateHandler' : too few template arguments error C3855: 'Fsm::StateHandler': template parameter 'stateParam' is incompatible with the declaration I'm totally stuck!!. I have no idea what is happening Greatly appreciate possible suggestions to get out of this
Member 9350237 wrote:
Greatly appreciate possible suggestions to get out of this
How about showing the line(s) that the compiler is complaining about.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Member 9350237 wrote:
Greatly appreciate possible suggestions to get out of this
How about showing the line(s) that the compiler is complaining about.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
Well, It's 4th line from last.
struct StateHandlerBase
{
SharedData data;
States state;
Transitions *m_interfaces[static_cast<size_t>(Size)];
StateHandlerBase()
: data(SharedData()),
state(static_cast<States>(InitState))/*, m_interfaces({0})*/
{
}}; typedef int DummyExplicitSpecialization; template <States stateParam, class Dummy=DummyExplicitSpecialization> struct StateHandler : StateHandler<static\_cast<States>(static\_cast<size\_t>(stateParam)-1)> { TransitionImplement<StateMachineComponents, static\_cast<States>(stateParam)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[static\_cast<size\_t>(stateParam)\] = &m\_interface; } }; template <class DummyExplicitSpecialization> struct StateHandler<static\_cast<States>(0), DummyExplicitSpecialization> : StateHandlerBase { TransitionImplement<StateMachineComponents, static\_cast<States>(0)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[0\] = &m\_interface; }
It's here---> };
typedef StateHandler<static\_cast<States>(TerminateState), DummyExplicitSpecialization> StateHanlderType;
StateHanlderType StateHanlderInstance;
-
Well, It's 4th line from last.
struct StateHandlerBase
{
SharedData data;
States state;
Transitions *m_interfaces[static_cast<size_t>(Size)];
StateHandlerBase()
: data(SharedData()),
state(static_cast<States>(InitState))/*, m_interfaces({0})*/
{
}}; typedef int DummyExplicitSpecialization; template <States stateParam, class Dummy=DummyExplicitSpecialization> struct StateHandler : StateHandler<static\_cast<States>(static\_cast<size\_t>(stateParam)-1)> { TransitionImplement<StateMachineComponents, static\_cast<States>(stateParam)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[static\_cast<size\_t>(stateParam)\] = &m\_interface; } }; template <class DummyExplicitSpecialization> struct StateHandler<static\_cast<States>(0), DummyExplicitSpecialization> : StateHandlerBase { TransitionImplement<StateMachineComponents, static\_cast<States>(0)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[0\] = &m\_interface; }
It's here---> };
typedef StateHandler<static\_cast<States>(TerminateState), DummyExplicitSpecialization> StateHanlderType;
StateHanlderType StateHanlderInstance;
Member 9350237 wrote:
StateHandlerBase::m_interfaces[static_cast<size_t>(stateParam)] = &m_interface;
Do you mean to have that
m_interface;
at the end of the line? Never mind. The HTML got in the way of what I was looking at.The difficult we do right away... ...the impossible takes slightly longer.
-
Member 9350237 wrote:
StateHandlerBase::m_interfaces[static_cast<size_t>(stateParam)] = &m_interface;
Do you mean to have that
m_interface;
at the end of the line? Never mind. The HTML got in the way of what I was looking at.The difficult we do right away... ...the impossible takes slightly longer.
Sorry I think the format got changed. Basically compiler pointing at forth line from last end of this structure
struct StateHandler(0), DummyExplicitSpecialization>
: StateHandlerBasestruct StateHandlerBase
{
SharedData data;
States state;
Transitions *m_interfaces[static_cast<size_t>(Size)];
StateHandlerBase()
: data(SharedData()),
state(static_cast<States>(InitState))/*, m_interfaces({0})*/
{
}}; typedef int DummyExplicitSpecialization; template <States stateParam, class Dummy=DummyExplicitSpecialization> struct StateHandler : StateHandler<static\_cast<States>(static\_cast<size\_t>(stateParam)-1)> { TransitionImplement<StateMachineComponents, static\_cast<States>(stateParam)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[static\_cast<size\_t>(stateParam)\] = &m\_interface; } }; template <class DummyExplicitSpecialization> struct StateHandler<static\_cast<States>(0), DummyExplicitSpecialization> : StateHandlerBase { TransitionImplement<StateMachineComponents, static\_cast<States>(0)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[0\] = &m\_interface; } }; typedef StateHandler<static\_cast<States>(TerminateState), DummyExplicitSpecialization> StateHanlderType;
StateHanlderType StateHanlderInstance;
-
Well, It's 4th line from last.
struct StateHandlerBase
{
SharedData data;
States state;
Transitions *m_interfaces[static_cast<size_t>(Size)];
StateHandlerBase()
: data(SharedData()),
state(static_cast<States>(InitState))/*, m_interfaces({0})*/
{
}}; typedef int DummyExplicitSpecialization; template <States stateParam, class Dummy=DummyExplicitSpecialization> struct StateHandler : StateHandler<static\_cast<States>(static\_cast<size\_t>(stateParam)-1)> { TransitionImplement<StateMachineComponents, static\_cast<States>(stateParam)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[static\_cast<size\_t>(stateParam)\] = &m\_interface; } }; template <class DummyExplicitSpecialization> struct StateHandler<static\_cast<States>(0), DummyExplicitSpecialization> : StateHandlerBase { TransitionImplement<StateMachineComponents, static\_cast<States>(0)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[0\] = &m\_interface; }
It's here---> };
typedef StateHandler<static\_cast<States>(TerminateState), DummyExplicitSpecialization> StateHanlderType;
StateHanlderType StateHanlderInstance;
Member 9350237 wrote:
Well, It's 4th line from last.
Depending on what you are considering a line, the fourth line from the last is:
StateHandler() : m_interface(StateHandlerBase::state, StateHandlerBase::data)
Member 9350237 wrote:
It's here---> };
Not sure which
};
instance you are referring to, but I do see a misplaced <pre> tag. Why is that there?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Sorry I think the format got changed. Basically compiler pointing at forth line from last end of this structure
struct StateHandler(0), DummyExplicitSpecialization>
: StateHandlerBasestruct StateHandlerBase
{
SharedData data;
States state;
Transitions *m_interfaces[static_cast<size_t>(Size)];
StateHandlerBase()
: data(SharedData()),
state(static_cast<States>(InitState))/*, m_interfaces({0})*/
{
}}; typedef int DummyExplicitSpecialization; template <States stateParam, class Dummy=DummyExplicitSpecialization> struct StateHandler : StateHandler<static\_cast<States>(static\_cast<size\_t>(stateParam)-1)> { TransitionImplement<StateMachineComponents, static\_cast<States>(stateParam)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[static\_cast<size\_t>(stateParam)\] = &m\_interface; } }; template <class DummyExplicitSpecialization> struct StateHandler<static\_cast<States>(0), DummyExplicitSpecialization> : StateHandlerBase { TransitionImplement<StateMachineComponents, static\_cast<States>(0)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[0\] = &m\_interface; } }; typedef StateHandler<static\_cast<States>(TerminateState), DummyExplicitSpecialization> StateHanlderType;
StateHanlderType StateHanlderInstance;
have you tried commenting out the
typedef
s andstruct
s to see which one is "bugging" the compiler? That might help to narrow it down."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Hi Guys!, I have been working on Finite state machine based on a well documented tutorial in code project Generic Finite State Machine (FSM)[^] I tried compiling the sample project available with this but can't proceed because of few errors. The project is develped with VS 2010 but I'm using 2012. I'll give the code excerpt where the error points..
struct StateHandlerBase
{
SharedData data;
States state;
Transitions *m_interfaces[static_cast<size_t>(Size)];
StateHandlerBase()
: data(SharedData()),
state(static_cast<States>(InitState))/*, m_interfaces({0})*/
{
}}; typedef int DummyExplicitSpecialization; template <States stateParam, class Dummy=DummyExplicitSpecialization> struct StateHandler : StateHandler<static\_cast<States>(static\_cast<size\_t>(stateParam)-1)> { TransitionImplement<StateMachineComponents, static\_cast<States>(stateParam)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[static\_cast<size\_t>(stateParam)\] = &m\_interface; } }; template <class DummyExplicitSpecialization> struct StateHandler<static\_cast<States>(0), DummyExplicitSpecialization> : StateHandlerBase { TransitionImplement<StateMachineComponents, static\_cast<States>(0)> m\_interface; StateHandler() : m\_interface(StateHandlerBase::state, StateHandlerBase::data) { StateHandlerBase::m\_interfaces\[0\] = &m\_interface; } }; typedef StateHandler<static\_cast<States>(TerminateState), DummyExplicitSpecialization> StateHanlderType;
StateHanlderType StateHanlderInstance;
These are the errors: error C2976: 'Fsm::StateHandler' : too few template arguments error C3855: 'Fsm::StateHandler': template parameter 'stateParam' is incompatible with the declaration I'm totally stuck!!. I have no idea what is happening Greatly appreciate possible suggestions to get out of this
-
Member 9350237 wrote:
Well, It's 4th line from last.
Depending on what you are considering a line, the fourth line from the last is:
StateHandler() : m_interface(StateHandlerBase::state, StateHandlerBase::data)
Member 9350237 wrote:
It's here---> };
Not sure which
};
instance you are referring to, but I do see a misplaced <pre> tag. Why is that there?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
A glitch in the Matrix. (Markdown bug)
What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???