When I init a new project, a root.zig file is also created.
What is the root.zig file? Can I remove it? if so why is it even generated by default.
I unfortunately could not find any place where this is documented.
When I init a new project, a root.zig file is also created.
What is the root.zig file? Can I remove it? if so why is it even generated by default.
I unfortunately could not find any place where this is documented.
zig init creates a project that can be used both a library (→root.zig) and an executable(→main.zig).
So if you only need the executable you can safely remove root.zig.
zig initcreates a project that can be used both a library (→root.zig)
Interesting. I would have expected that to be named lib.zig
I think it’s convention. You could name it anything, you’d just need to update the root_source_file parameter in the build.zig. I don’t think there is anything “special” with root.zig files ala mod.rs in rust