cglm icon indicating copy to clipboard operation
cglm copied to clipboard

CGLM_USE_ANONYMOUS_STRUCT: expected an expression

Open EranStockdale opened this issue 6 months ago • 5 comments

Hello there!

I'm trying to use cglm. It was working fine until I set my C++ standard (yes yes I know cglm is for C) to C++20, I'm getting errors such as this:

src/client/main.cpp:191:101: error: 'vec3s' {aka 'union vec3s'} has no member named 'x'
  191 |                         ImGui::Text("Camera Movement Direction %f, %f, %f", cameraMovementDirection.x, cameraMovementDirection.y, cameraMovementDirection.z);

Now, I dug into cglm/struct.h and found

#if CGLM_USE_ANONYMOUS_STRUCT

blocking the property definitions. Okay, that's fine, add -DCGLM_USE_ANONYMOUS_STRUCT to the compiler flags. Nope. Here: Image

Anyhow, how can I fix this? I have a feeling the ifs should be ifdefs. I'm happy to submit a PR if this is the case.

Thanks, Eran

EranStockdale avatar May 07 '25 20:05 EranStockdale