forked from skypjack/entt
-
Notifications
You must be signed in to change notification settings - Fork 0
Errors
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
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
Output
...
Cause
Likely caused by view<A, B, C>
not lining up e.g. each(A&, B&)
, notice the missing C&
.
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.
EnTT - Fast and Reliable ECS (Entity Component System)
Table of contents
Examples
Blog
- RAII
- Polymorphism
- Shared Components
- Intent System
- Input Handling
- Undo
- Operator Stack
- State
- Resources
- Interpolation
Resources
Extras