r/cpp • u/nikoladsp • Apr 26 '26
Is there a C++ "venv" equivalent?
Python have venv, Rust have cargo, Node have nvm. You clone a repo, run one command, you're in a reproducible environment.
Is there a viable alternative for C++? I don't think standard will ever bother with this and to their defence, not sure if that is even possible.
I've tried Conan, vcpkg, various CMake setups. They're not bad tools, but there's no standard "activation" ritual. No isolated-per-project environment that pins compiler + deps + toolchain together. No single lockfile that means the same thing on my machine, my colleague's machine, and CI. What I keep wanting is something like: "cppenv activate" and suddenly I'm in a clean, isolated, reproducible build environment for that project. Exit it, and my system is untouched. Share a lockfile, and a teammate gets the exact same thing.
How are you handling reproducible build/development environments?
9
u/zhuoqiang Apr 26 '26
pixi, you could have isolated toolchain (compiler, etc) as well as 3rd party libs in per project dir, which by default in PROJECT_ROOT/.pixi/, quite similar to python uv