13
114
Fork
You've already forked zig-sdl3
19

renderDebugTextFormat fails to compile due to Zig API change #166

Closed
opened 2026年01月27日 17:23:59 +01:00 by KevinJones · 2 comments

I noticed this issue when trying to print some debug text to the screen. When my code includes a call to sdl3.render.renderDebugTextFormat, the code fails to compile with a message like:

~/.cache/zig/p/sdl3-0.1.6-NmT1Q5sQJgCzT6hLj7WOSrwxE0Qsef1wIkDopbOOFru0/src/render.zig:1304:32: error: root source file struct 'fmt' has no member named 'allocPrintZ'
 const msg = try std.fmt.allocPrintZ(allocator, fmt, args);

Context:

Line 1556 in 92b8360
constmsg=trystd.fmt.allocPrintZ(allocator,fmt,args);

This happens because Zig 0.15.1 made some changes to the standard library API, including the removal of std.fmt.allocPrintZ in favor of std.fmt.allocPrintSentinel. I believe a simple fix is to replace the previous line with this:

constmsg=trystd.fmt.allocPrintSentinel(allocator,fmt,args,0);

Thanks for your time.

Versions: Zig 0.15.2, zig-sdl3 0.1.6 (also present on master)
Platform: Ubuntu 24.04.3 LTS (via WSL)

I noticed this issue when trying to print some debug text to the screen. When my code includes a call to sdl3.render.renderDebugTextFormat, the code fails to compile with a message like: ``` ~/.cache/zig/p/sdl3-0.1.6-NmT1Q5sQJgCzT6hLj7WOSrwxE0Qsef1wIkDopbOOFru0/src/render.zig:1304:32: error: root source file struct 'fmt' has no member named 'allocPrintZ' const msg = try std.fmt.allocPrintZ(allocator, fmt, args); ``` Context: https://codeberg.org/7Games/zig-sdl3/src/commit/92b83602cdfa59262e73c023df906c78eef73455/src/render.zig#L1556 This happens because Zig 0.15.1 made some changes to the standard library API, including the removal of `std.fmt.allocPrintZ` in favor of [`std.fmt.allocPrintSentinel`](https://ziglang.org/documentation/0.15.2/std/#std.fmt.allocPrintSentinel). I believe a simple fix is to replace the previous line with this: ```zig const msg = try std.fmt.allocPrintSentinel(allocator, fmt, args, 0); ``` Thanks for your time. Versions: Zig 0.15.2, zig-sdl3 0.1.6 (also present on master) Platform: Ubuntu 24.04.3 LTS (via WSL)
Gota7 added this to the Jupiter project 2026年01月27日 17:40:23 +01:00
Owner
Copy link

Thanks, I should be able to fix this tonight.

Thanks, I should be able to fix this tonight.
Owner
Copy link

Fixed in 3e780b7ce6

Fixed in https://codeberg.org/7Games/zig-sdl3/commit/3e780b7ce649ff188b58d2470446bda2760ede9f
Sign in to join this conversation.
No Branch/Tag specified
master
master-gpu
docs
image-updates
net-cleanup
vulkan-template
shadercross
better-documentation-and-examples
145-web-ci
yaml-rework
v0.2.2
v0.2.1
v0.2.0
v0.1.9
v0.1.8
v0.1.7
v0.1.6
v0.1.5
v0.1.4
v0.1.3
v0.1.2
v0.1.1
v0.1.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
7Games/zig-sdl3#166
Reference in a new issue
7Games/zig-sdl3
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?