Skip to content
Alan Jefferson edited this page Jan 22, 2020 · 4 revisions

EnTT is mostly templates and lambdas, and neither of those make for very good error messages. Here's how to interpret the various garbage messages you may be presented with.

Errors


C2440

Output

error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'Type'

Cause

Likely caused by assign<A>() and passing the wrong arguments for initialising A.

Reproducible

struct A {
  float number;
  const char* text;
};

entt::registry registry{};
auto entity = registry.create();
registry.assign<A>(entity, "Hello", 5.0f);  // Notice the reversed arguments

C0000

Output

...

Cause

Likely caused by view<A, B, C> not lining up e.g. each(A&, B&), notice the missing C&.


!has(entt)

You tried registry.assign<A>(entity) but entity already had A assigned. That's undefined behavior. Try either making sure it isn't already assigned, or use registry.assign_or_replace<A>(entity) if A pre-existing component is ok.