Skip to content

Comment on Using Zig as cross-platform C toolchainparent

Comments

Does it also work with C++?

It wraps clang, so it supports whatever clang supports, C++ included.

Also, does it also work with build systems like CMake flawlessly?

I haven't personally tried it, but I'd expect that if all else fails you could add a step in build.zig to run CMake and then link against whatever library you just built.

Does this include libc++ (compiled shared library of the STL complete with headers and debug symbols?) Although I hate most parts of the STL I still find myself using some parts of it (std::vector, std::string, <algorithm>, <type_traits>, etc.). Maybe I can link libc++ as an external library but then that's too much busywork needed for Zig to be a complete C++ dev environment out-of-the-box.

As an experiment a while back, I had tried in on a small project of mine that uses std::vector, std::string, and <algorithm> (though not a whole lot else). It built, ran, and passed my test suite.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.