recp / cglm

📽 Highly Optimized 2D / 3D Graphics Math (glm) for C
MIT License
2.26k stars 229 forks source link

`I` macro is used as variable name in new vec_reflect / vec_refract functions #404

Closed olifre closed 6 months ago

olifre commented 6 months ago

Including complex.h from standard C (see https://en.cppreference.com/w/c/numeric/complex ) defines the macro I, which causes issues with the variable name I used starting with CGLM 0.9.3.

See for example:

In file included from ../src/util/compat.h:13,
                 from ../src/taisei.h:13,
                 from ../src/boss.c:9:
../subprojects/cglm/include/cglm/vec2.h:725:23: error: expected ‘)’ before ‘__extension__’
  725 | glm_vec2_reflect(vec2 I, vec2 N, vec2 dest) {
      |                       ^
In file included from ../subprojects/cglm/include/cglm/cglm.h:12,
                 from ../src/util/glm.h:20,
                 from ../src/boss.c:17:
../subprojects/cglm/include/cglm/vec2.h:725:26: error: expected ‘;’, ‘,’ or ‘)’ before ‘vec2’
  725 | glm_vec2_reflect(vec2 I, vec2 N, vec2 dest) {
      |                          ^~~~

in one program using CGLM and including complex.h before.

recp commented 6 months ago

Hi @olifre,

Wow, thanks for reporting this, I tried to fix this at https://github.com/recp/cglm/pull/406 and new Release will be soon.

recp commented 6 months ago

@olifre the PR is merged I think the issue was dissolved. v0.9.4 will be released soon which will contain this bugfix.

recp commented 6 months ago

The issue is fixed at v0.9.4: https://github.com/recp/cglm/releases

Thanks for reporting this