raylib-cpp icon indicating copy to clipboard operation
raylib-cpp copied to clipboard

(StructName) {...} gives error C4576 with MSVC

Open Marriaud opened this issue 5 years ago • 5 comments

Example on line : https://github.com/RobLoach/raylib-cpp/blob/2245a4f959c2a75e25e2efa8a683518465786089/examples/core/core_3d_camera_first_person.cpp#L66

If I remove the brackets around Vector3, it works. (it also works without casting)

The issue has been encountered by a realib user. See pull request https://github.com/raysan5/raygui/pull/44/ and issue https://github.com/raysan5/raygui/issues/33

Marriaud avatar Nov 06 '20 12:11 Marriaud

It's still not fixed

megapro17 avatar Nov 24 '21 05:11 megapro17

do u have solution for that ?

thomaswtn01 avatar Jun 27 '22 12:06 thomaswtn01

Is this still an issue?

RobLoach avatar Jun 27 '22 12:06 RobLoach

Not an issue, not coding in C++ anymore

megapro17 avatar Jun 28 '22 02:06 megapro17

@megapro17 you need to use CLITERAL define since (Vector3){ 0.0f, 0.0f, 0.0f } is for C not C++, if you want to code in c++ you need to remove the ( and ) like this: Vector3{ 0.0f, 0.0f, 0.0f } or with the define CLITERAL(Vector3){ 0.0f, 0.0f, 0.0f } it will convert from c or c++ automatically :) PS: CLITERAL is from raylib.h

TokyoSU avatar Jul 03 '22 06:07 TokyoSU