Skip to content

Cannot compile with zig 0.15.1 #19

@Logickin-Lambda

Description

@Logickin-Lambda

During waiting for the zgui pull request that including the zig 0.15.1 update, I decided to spend some time for checking if there are other libraries can't build with the latest version.

Since I am currently use zgui + zgpu + zglfw + zaudio a lot for some learning projects and I expect to use them a lot in the near future, I decided to check if these libraries can be compiled properly. I have found that zgpu can't compile with zig 0.15.1, so I attempted to update the library; however, seems like I have came across a part of the code I am not familiar with:

usingnamespace if (emscripten) struct {
    // Missing symbols
    var wgpuDeviceTickWarnPrinted: bool = false;
    pub export fn wgpuDeviceTick() void {
        if (!wgpuDeviceTickWarnPrinted) {
            std.log.warn("wgpuDeviceTick(): this fn should be avoided! RequestAnimationFrame() is advised for smooth rendering in browser.", .{});
            wgpuDeviceTickWarnPrinted = true;
        }
        emscripten_sleep(1);
    }
} else struct {};

Because of the recent update to the usingnamespace, it throws this error:

src\zgpu.zig:1858:16: error: expected ',' after field
usingnamespace if (emscripten) struct {

However, I am not familiar with usingnamespace, neither I work on emscripten projects, so I am not sure what is the intended compilation results and behavior of the emscripten application. Anyone have some ideas with it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions