Giter Club home page Giter Club logo

Comments (4)

amaiorano avatar amaiorano commented on July 20, 2024

Hi there,

If you disable RTTI, you'll need to add the DEFINE_HSM_STATE() macros in each of your states to inject the custom RTTI info needed by hsm. Check out the info in the documentation:
https://github.com/amaiorano/hsm/wiki/Chapter-1.-Getting-Started#rtti

If you haven't already, I highly recommend reading the doc. Let me know if that works for you! I've shipped UE4 multiple games that use HSM, so it should work out just fine.

from hsm.

Adv4nc3d123 avatar Adv4nc3d123 commented on July 20, 2024

Hi, this is what I am doing right now (just leaving 1 state in there) and the baseState in there in case I happen to be using the wrong syntax;

struct MyStates
{
struct BaseState : hsm::StateWithOwner
{
DEFINE_HSM_STATE(BaseState);
};
struct Grabbed : BaseState
{
DEFINE_HSM_STATE(Grabbed);

	virtual hsm::Transition GetTransition()
	{
		if (!Owner().m_pBlackboard->GetValueAsBool(ISGRABBED))
			return hsm::SiblingTransition<FallLoop>();

		return hsm::NoTransition();
	}
	virtual void OnEnter()
	{
		Owner().m_bShouldProcess = true;
		Owner().m_Animstate = EAnimEnum::Grabbed;
	}
};

};

this throws me all of these erors:
Severity Code Description Project File Line Suppression State
Error (active) E0135 namespace "hsm" has no member "StateTypeIdStorage" FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 33
Error (active) E0135 namespace "hsm" has no member "StateTypeIdStorage" FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 38
Error (active) E0135 namespace "hsm" has no member "StateTypeIdStorage" FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 69
Error (active) E0135 namespace "hsm" has no member "StateTypeIdStorage" FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 108
Error (active) E0135 namespace "hsm" has no member "StateTypeIdStorage" FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 140
Error (active) E0135 namespace "hsm" has no member "StateTypeIdStorage" FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 164
Error (active) E0135 namespace "hsm" has no member "StateTypeIdStorage" FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 196
Error (active) E0135 namespace "hsm" has no member "StateTypeIdStorage" FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 217
Error (active) E0135 namespace "hsm" has no member "StateTypeIdStorage" FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 234
Error (active) E0135 namespace "hsm" has no member "StateTypeIdStorage" FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 250
Error (active) E0135 namespace "hsm" has no member "StateTypeIdStorage" FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 266
Error C2039 'StateTypeIdStorage': is not a member of 'hsm' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 33
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 33
Error C2146 syntax error: missing ';' before identifier 'sStateTypeId' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 33
Error C3861 'sStateTypeId': identifier not found FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 33
Error C2065 'sStateTypeId': undeclared identifier FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 33
Error C2039 'StateTypeIdStorage': is not a member of 'hsm' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 38
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 38
Error C2146 syntax error: missing ';' before identifier 'sStateTypeId' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 38
Error C3861 'sStateTypeId': identifier not found FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 38
Error C2065 'sStateTypeId': undeclared identifier FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 38
Error C2039 'StateTypeIdStorage': is not a member of 'hsm' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 69
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 69
Error C2146 syntax error: missing ';' before identifier 'sStateTypeId' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 69
Error C3861 'sStateTypeId': identifier not found FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 69
Error C2065 'sStateTypeId': undeclared identifier FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 69
Error C2039 'StateTypeIdStorage': is not a member of 'hsm' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 108
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 108
Error C2146 syntax error: missing ';' before identifier 'sStateTypeId' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 108
Error C3861 'sStateTypeId': identifier not found FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 108
Error C2065 'sStateTypeId': undeclared identifier FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 108
Error C2039 'StateTypeIdStorage': is not a member of 'hsm' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 140
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 140
Error C2146 syntax error: missing ';' before identifier 'sStateTypeId' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 140
Error C3861 'sStateTypeId': identifier not found FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 140
Error C2065 'sStateTypeId': undeclared identifier FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 140
Error C2039 'StateTypeIdStorage': is not a member of 'hsm' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 164
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 164
Error C2146 syntax error: missing ';' before identifier 'sStateTypeId' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 164
Error C3861 'sStateTypeId': identifier not found FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 164
Error C2065 'sStateTypeId': undeclared identifier FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 164
Error C2039 'StateTypeIdStorage': is not a member of 'hsm' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 196
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 196
Error C2146 syntax error: missing ';' before identifier 'sStateTypeId' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 196
Error C3861 'sStateTypeId': identifier not found FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 196
Error C2065 'sStateTypeId': undeclared identifier FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 196
Error C2039 'StateTypeIdStorage': is not a member of 'hsm' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 217
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 217
Error C2146 syntax error: missing ';' before identifier 'sStateTypeId' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 217
Error C3861 'sStateTypeId': identifier not found FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 217
Error C2065 'sStateTypeId': undeclared identifier FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 217
Error C2039 'StateTypeIdStorage': is not a member of 'hsm' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 234
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 234
Error C2146 syntax error: missing ';' before identifier 'sStateTypeId' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 234
Error C3861 'sStateTypeId': identifier not found FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 234
Error C2065 'sStateTypeId': undeclared identifier FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 234
Error C2039 'StateTypeIdStorage': is not a member of 'hsm' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 250
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 250
Error C2146 syntax error: missing ';' before identifier 'sStateTypeId' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 250
Error C3861 'sStateTypeId': identifier not found FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 250
Error C2065 'sStateTypeId': undeclared identifier FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 250
Error C2039 'StateTypeIdStorage': is not a member of 'hsm' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 266
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 266
Error C2146 syntax error: missing ';' before identifier 'sStateTypeId' FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 266
Error C3861 'sStateTypeId': identifier not found FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 266
Error C2065 'sStateTypeId': undeclared identifier FluffyFactory C:\perf\Grp_Fluffy\Dev\FluffyFactory\Source\FluffyFactory\FluffyCharacter.cpp 266

which are basically the same for every state I Define
I am currently using the latest Release Build I could find on here.

from hsm.

Adv4nc3d123 avatar Adv4nc3d123 commented on July 20, 2024

So I downloaded the second latest release (1.5) and had to comment the line //static_assert(std::is_convertible<TargetState, State>::value, "TargetState must derive from hsm::State");

and add this define at the start to make it build
#define HSM_CPP_RTTI 0

Seems to me there must be something missing in the latest release or the syntax of something has changed which I am not aware off.

from hsm.

amaiorano avatar amaiorano commented on July 20, 2024

So I downloaded the second latest release (1.5) and had to comment the line //static_assert(std::is_convertible<TargetState, State>::value, "TargetState must derive from hsm::State");

This assert is important, you should not remove it. If you're triggering it, it means you've probably added a DEFINE_HSM_STATE somewhere you shouldn't. This macro should only really be added to the actual states you transition to, not to base classes for your states. I noticed in the code you pasted above that you had added this macro to your BaseState, which you shouldn't be doing (see this example: https://github.com/amaiorano/hsm/blob/master/samples/hsm_book_samples/source/ch3/drawing_hsms.cpp).

and add this define at the start to make it build
#define HSM_CPP_RTTI 0

This is correct. You are supposed to define this to 0 to disable C++ RTTI, and make use of the custom RTTI. I assume you had already done this even before downgrading.

Seems to me there must be something missing in the latest release or the syntax of something has changed which I am not aware off.

I think you found a bug in the latest version related to custom RTTI. When I get the chance, I'll take a look and see what's up. For now, using 1.5 should be perfectly fine.

from hsm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.