Hi, I’m trying to rewrite one of my old hobby projects in Zig. The project uses X11
library for GUI. I ran into this error:
cimport.zig:3903:136: error: expected type 'usize', found 'c_int'
pub inline fn ScreenOfDisplay(dpy: anytype, scr: anytype) @TypeOf(&@import("std").zig.c_translation.cast(_XPrivDisplay, dpy).*.screens[scr]) {
^~~
cimport.zig:3903:136: note: unsigned 64-bit int cannot represent all possible signed 32-bit values
referenced by:
DefaultColormap: cimport.zig:3882:67
guiInit: gui.zig:106:17
Error points to this code:
102 gd.display = xwin.XOpenDisplay(null).?;
103 gd.screen = @intCast(isize, xwin.DefaultScreen(gd.display));
104 xwin.XAllocNamedColor(
105 gd.display,
106 xwin.DefaultColormap(gd.display, xwin.DefaultScreen(gd.display)),
107 "SteelBlue",
108 &gd.fg_color, &color
109 );
screen
is isize
. I tried different types for it, but had no success.
What could it be?
Something is wrong with my code?
Or maybe something is wrong with cimport.zig?