Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help Wanted] Having an issue setting up Raylib and C++ #73

Open
Susseratal opened this issue Dec 21, 2024 · 1 comment
Open

[Help Wanted] Having an issue setting up Raylib and C++ #73

Susseratal opened this issue Dec 21, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Susseratal
Copy link

The title is pretty self explanatory, but I'm trying to use clay_renderer_raylib.c with C++, and whenever I compile, I get a bunch of errors which read
Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax
They're all pointing to different lines in clay_render_raylib.c. I'm not sure if I need to define or flag something to stop this from being an issue, but I can't figure it out. I have my project configured to ISO C++ 20, and ISO C17 for C++ and C respectively.

If you need more info, let me know.

@nicbarker
Copy link
Owner

I'm reasonably certain I know what the issue is here. Designated initializer syntax is slightly different between C99 and C++20. In the clay.h file we use the CLAY__INIT macro to solve this:

// C99 Style
(Rectangle) { .width = 5, .height = 5 };
// C++20 Style
Rectangle { .width = 5, .height = 5 };
// CLAY__INIT compatibility layer
CLAY__INIT(Rectangle) { .width = 5, .height = 5 };

You can see that there are a number of C99 style designated inits in the raylib renderer that aren't wrapped in CLAY__INIT. It's just a matter of getting those fixed up 🙂

@nicbarker nicbarker self-assigned this Dec 21, 2024
@nicbarker nicbarker added the enhancement New feature or request label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants