ikskuh / zig-args

Simple-to-use argument parser with struct-based config
MIT License
243 stars 27 forks source link

Compiling error with parseForCurrentProcess() #35

Closed malespiaut closed 2 years ago

malespiaut commented 2 years ago

zig-args version

Commit 51a3a827126bcd285fd790934ea0d7114f3422e0

Steps to Reproduce

Try to build an example using parseForCurrentProcess().

Expected Behavior

Successful compilation.

Actual Behavior

Zig returns the following error message:

./src/args/args.zig:14:38: error: expected 2 argument(s), found 1
    const executable_name = args.next() orelse {
                                     ^
./src/main.zig:85:48: note: called from here
    const options = args.parseForCurrentProcess(struct {
                                               ^
./src/main.zig:83:21: note: called from here
pub fn main() !void {
                    ^
/usr/lib/zig/std/process.zig:477:9: note: declared here
    pub fn next(self: *ArgIterator, allocator: Allocator) ?(NextError![:0]u8) {
        ^

Best regards.

ikskuh commented 2 years ago

Which zig version do you use? zig-args tracks master and was just updated to use the latest zig version. IF you use an older version, you have to choose an older commit of zig-args.

malespiaut commented 2 years ago

Hello,

Thank you very much for your fast answer.

I'm using Zig v0.9.1. I'll test it with the latest git revision of Zig as soon as LLVM 15 is available for my OS (Arch Linux).

Best regards.

ikskuh commented 2 years ago

There's the zig-0.9.0 tag available which should be compatible to your version