Closed Viza74 closed 4 years ago
The good thing about posting bur reports that one usually finds new info immediately after posting it... :)
So it seems to be that the compilation error is caused by the embedded C.Vector2 srtucts inside the C.Camera2D struct.
If I remove those from the initialization, it compiles without error.
So are embedded C structs inside C struct are supported in v (yet)?
Related to this https://github.com/vlang/v/issues/570#issuecomment-505405478, when you use C.Camera2D
you should just call it Camera2D
The good thing about posting bur reports that one usually finds new info immediately after posting it... :)
So it seems to be that the compilation error is caused by the embedded C.Vector2 srtucts inside the C.Camera2D struct.
If I remove those from the initialization, it compiles without error.
So are embedded C structs inside C struct are supported in v (yet)?
If we related to https://github.com/vlang/v/issues/570#issuecomment-505405478 again maybe your field type shoukd just be Vector2``but you have to define
C.Vector2` before in your V code.
Oooh, so I can use those strcuts without C. prefix?...
Removed them, and now the program compiles. (Still not working, but that probably something unrelated.)
Should we close this issue as working as intended, or should C structs in C struct is something which should compile in that form and keep this open?
This is fixed in the new parser.
V version: 0.1.2 OS: macos C compiler version:
What did you do? Building small test game using the raylib c library.
I started a v module wrapping some raylib functionality I need in the main program. One of the things in the module is the structure definition for the raylib Camera2D struct:
Which is used like this in the main program:
What did you expect to see?
The program compiles and runs :)
What did you see instead?
This error message:
the relevant part of the ray.c mentioned in the error message:
I don't know what is this generated c file, or why it is includes those empty "struct" keywords... All the other C structs (C.Vector2, C.Color, etc. defined similarly in the module) are working fine, so it seems to be a bug, but if I do something incorrectly, just tell me :)