Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Build errors !

Build errors !

Scheduled Pinned Locked Moved C / C++ / MFC
helpvisual-studiocomtutorialquestion
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 9350237
    wrote on last edited by
    #1

    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

    D L 2 Replies Last reply
    0
    • M Member 9350237

      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

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      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

      M 1 Reply Last reply
      0
      • D David Crow

        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

        M Offline
        M Offline
        Member 9350237
        wrote on last edited by
        #3

        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;

        Richard Andrew x64R D 2 Replies Last reply
        0
        • M Member 9350237

          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;

          Richard Andrew x64R Offline
          Richard Andrew x64R Offline
          Richard Andrew x64
          wrote on last edited by
          #4

          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.

          M 1 Reply Last reply
          0
          • Richard Andrew x64R Richard Andrew x64

            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.

            M Offline
            M Offline
            Member 9350237
            wrote on last edited by
            #5

            Sorry I think the format got changed. Basically compiler pointing at forth line from last end of this structure

            struct StateHandler(0), DummyExplicitSpecialization>
            : StateHandlerBase

            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;

            D 1 Reply Last reply
            0
            • M Member 9350237

              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;

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              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

              B 1 Reply Last reply
              0
              • M Member 9350237

                Sorry I think the format got changed. Basically compiler pointing at forth line from last end of this structure

                struct StateHandler(0), DummyExplicitSpecialization>
                : StateHandlerBase

                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;

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                have you tried commenting out the typedefs and structs 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

                1 Reply Last reply
                0
                • M Member 9350237

                  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

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  You should really use the forum at the end of the article, so the person who wrote the code can help you.

                  1 Reply Last reply
                  0
                  • D David Crow

                    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

                    B Offline
                    B Offline
                    Brisingr Aerowing
                    wrote on last edited by
                    #9

                    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???

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups