Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of module imports affect availability of Units #1300

Closed
domdom opened this issue Aug 11, 2024 · 0 comments · Fixed by #1312
Closed

Order of module imports affect availability of Units #1300

domdom opened this issue Aug 11, 2024 · 0 comments · Fixed by #1312
Labels
bug Something isn't working

Comments

@domdom
Copy link
Contributor

domdom commented Aug 11, 2024

Describe the bug
Importing the 'flecs::stats' module before the 'flecs::units' module results in an error message when trying to register a component member as having a given Unit type.

To Reproduce
Consider the following code:

#include <flecs.h>

int main() {

    flecs::world world;
    world.import<flecs::stats>();
    world.import<flecs::units>();

    struct Foo {
        float x;
    };

    world.component<Foo>().member<flecs::units::length::Meters>("x", &Foo::x);

    return 0;
}

Running that code emits the following:

error: meta.c: 392: entity 'Meters' for member 'x' is not a unit

Swapping the order of those two imports fixes the issue.

NB: This is running on v4.0.0 of flecs.

@domdom domdom added the bug Something isn't working label Aug 11, 2024
domdom added a commit to domdom/flecs that referenced this issue Aug 18, 2024
domdom added a commit to domdom/flecs that referenced this issue Aug 18, 2024
domdom added a commit to domdom/flecs that referenced this issue Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant