jdah / minecraft-weekend

Minecraft, but I made it in 48 hours.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiling dont works because of redefinitions

Benn1x opened this issue · comments

i compiled it like this
make libs && make
and got following error:

typedef union ivec2s {
              ^
lib/cglm/include/cglm/struct/clipspace/../../types-struct.h:85:15: note: previous definition is here
typedef union ivec2s {
              ^
In file included from src/block/air.c:1:
In file included from src/block/block.h:4:
In file included from src/block/../util/util.h:25:
src/block/../util/ivec2s.h:69:3: error: typedef redefinition with different types ('union (unnamed union at src/block/../util/ivec2s.h:61:15)' vs 'union ivec2s')
} ivec2s;

Just delete the definition in ivec2s.h

Try checking out cglm branch v0.8.4:

cd ./lib/cglm
git checkout v0.8.4
cd ../../
make libs
make
./bin/game

Fixed by doing two things

cd ./lib/cglm
git checkout 2a4748d    # As mentioned in https://github.com/recp/cglm/issues/240
cd ../../
make libs

Editing file src/util/ivec2s.h and disabling the union type

#if 0
typedef union ivec2s {
  ivec2 raw;
#if CGLM_USE_ANONYMOUS_STRUCT
  struct {
    int x;
    int y;
  };
#endif
} ivec2s;
#endif

The game then compiles normally

I don't have clang and didn't wanna install it so I change the CC to gcc and just removed -fbracket-depth=1024 from the Makefile.

All works great, except I tried digging down for a while and this happened, not sure if it's related but cool none the less!

game: src/world/world.c:191: world_heightmap_recalculate: Assertion `world_in_bounds(self, (ivec3s) {{ p.x, 0, p.y }})' failed.