GodotECS / godex

Godex is a Godot Engine ECS library.
MIT License
1.22k stars 67 forks source link

Linux compilation gives problem on component and databags declared inside a namespace #263

Open RicardRC opened 3 years ago

RicardRC commented 3 years ago

For example:

namespace pixiel {

class StaticDataDatabag : public godex::Databag{
    DATABAG(StaticDataDatabag);
    static void _bind_methods();
public:
    ~StaticDataDatabag();
    StaticDataDatabag() {}

Gets me:

In file included from /home/ricard/Documents/Pixiel/PixielCore/register_types.cpp:10:
/home/ricard/Documents/Pixiel/godex/ecs.h:694:32: error: 'uint32_t pixiel::StaticDataDatabag::databag_id' is private within this context
  694 |  ClassDB::bind_integer_constant(get_class_static(), StringName(), databag_name, R::databag_id);
      |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/ricard/Documents/Pixiel/godex/systems/system_builder.h:3,
                 from /home/ricard/Documents/Pixiel/godex/ecs.h:8,
                 from /home/ricard/Documents/Pixiel/PixielCore/register_types.cpp:10:
/home/ricard/Documents/Pixiel/godex/systems/../databags/databag.h:31:25: note: declared private here
   31 |  static inline uint32_t databag_id = UINT32_MAX;                  \
      |                         ^~~~~~~~~~
/home/ricard/Documents/Pixiel/PixielCore/ecs/databag_static.h:30:2: note: in expansion of macro 'DATABAG'
   30 |  DATABAG(StaticDataDatabag);
      |  ^~~~~~~

Only linux, on windows works wonderfully.