minecraft-weekend icon indicating copy to clipboard operation
minecraft-weekend copied to clipboard

Compiling dont works because of redefinitions

Open Benn1x opened this issue 2 years ago • 4 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;

Benn1x avatar Jun 07 '22 10:06 Benn1x

Just delete the definition in ivec2s.h

PR0BLEMCH1LD avatar Aug 17 '22 16:08 PR0BLEMCH1LD

Try checking out cglm branch v0.8.4:

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

bramtechs avatar Oct 22 '22 20:10 bramtechs

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

heysokam avatar Dec 15 '22 06:12 heysokam

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.

anthonywww avatar Apr 16 '23 06:04 anthonywww