Skip to content

C Compiler Error in Build of GUI #24306

@mike-ward

Description

@mike-ward

Describe the bug

Building the buttons.v program described below causes a C compiler build error.

Reproduction Steps

(substitute the /Users/mike/gui/src with cloned source

Expected Behavior

Builds the program successfully

Current Behavior

================== C compilation error (from cc): ==============
cc:       |                                ^
cc: /tmp/v_501/buttons.01JSJ00CX3TQS83956TAQPH7WW.tmp.c:7177:51: error: indirection requires pointer operand ('gui__Container' (aka 'struct gui__Container') invalid)
cc:  7177 |         return I_gui__Container_to_Interface_gui__View(&(*(_V_closure_ctx->view)));
cc:       |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
cc: /tmp/v_501/buttons.01JSJ00CX3TQS83956TAQPH7WW.tmp.c:14085:103: warning: implicit conversion from enumeration type 'sokol__gfx__LoadAction' to different enumeration type 'sg_load_action' (aka 'enum sg_load_action') [-Wenum-conversion]
cc:  14085 |         sokol__gfx__ColorAttachmentAction color_action = ((sokol__gfx__ColorAttachmentAction){.load_action = sokol__gfx__LoadAction__clear,.store_action = 0,.clear_value = ((sokol__gfx__Color){.r = r,.g = g,.b = b,.a = a,}),});
cc:        |                                                                                              ~               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc: /tmp/v_501/buttons.01JSJ00CX3TQS83956TAQPH7WW.tmp.c:14511:32: warning: implicit conversion from enumeration type 'sokol__gfx__PixelFormat' to different enumeration type 'sg_pixel_format' (aka 'enum sg_pixel_format') [-Wenum-conversion]
cc:  14511 |         env.defaults.color_format = (*(sokol__gfx__PixelFormat*)_t1.data);
cc:        |                                   ~  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc: /tmp/v_501/buttons.01JSJ00CX3TQS83956TAQPH7WW.tmp.c:14518:32: warning: implicit conversion from enumeration type 'sokol__gfx__PixelFormat' to different enumeration type 'sg_pixel_format' (aka 'enum sg_pixel_format') [-Wenum-conversion]
cc:  14518 |         env.defaults.depth_format = (*(sokol__gfx__PixelFormat*)_t2.data);
...

Possible Solution

The problem function is on line 138 of buttons.v (fn msg_box). Commenting out the call to w.message_box allows for a successful build.

Additional Information/Context

Tried working around this by passing Window reference in MessageBoxCfg. Same error.

V version

V 0.4.10 a0a8324

Environment details (OS name and version, etc.)

V full version V 0.4.10 da3112e.a0a8324
OS macos, macOS, 15.3.2, 24D81
Processor 8 cpus, 64bit, little endian, Apple M2
Memory 0.15GB/8GB
V executable /Users/mike/Documents/github/v/v
V last modified time 2025-04-21 20:29:18
V home dir OK, value: /Users/mike/Documents/github/v
VMODULES OK, value: /Users/mike/.vmodules
VTMP OK, value: /tmp/v_501
Current working dir OK, value: /Users/mike/Documents/github/gui/src/examples
env VFLAGS "-path /Users/mike/Documents/github/gui/src
Git version git version 2.49.0
V git status weekly.2025.14-79-ga0a83248 (4 commit(s) behind V master)
.git/config present true
cc version Apple clang version 17.0.0 (clang-1700.0.13.3)
gcc version Apple clang version 17.0.0 (clang-1700.0.13.3)
clang version Apple clang version 17.0.0 (clang-1700.0.13.3)
tcc version tcc version 0.9.28rc 2024-02-05 HEAD@105d70f7 (AArch64 Darwin)
tcc git status thirdparty-macos-arm64 c8df4e27
emcc version N/A
glibc version N/A

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Metadata

Metadata

Assignees

Labels

BugThis tag is applied to issues which reports bugs.Status: ConfirmedThis bug has been confirmed to be valid by a contributor.Unit: CheckerBugs/feature requests, that are related to the type checker.Unit: cgenBugs/feature requests, that are related to the default C generating backend.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions