Just wondering the best way to install cpp packages. My background is in JS/Ruby/etc, so it seems so weird there's no cpm
or the like. What am I missing? I assume it's not this simple...
For an example, I can't even run a .cpp file with #include <iostream>
as I get fatal error: 'iostream' file not found
Edit for clarity: iostream
was a bad example, my system config was wonked back when I wrote this. Replace it in your imagination with a non-standard library.
Perhaps because C++ is less homogenous. Apple provides more standard stuff to build packages on top off. In C++ one can hardly agree on what string class to use. I would just like to point out that the package managers from other languages are not perfect.
vcpkg is a free C/C++ package manager for acquiring and managing libraries. Choose from over 1500 open source libraries to download and build in a single step or add your own private libraries to simplify your build process. Maintained by the Microsoft C++ team and open source contributors.
No, the C++ language specification does not require packages nor package managers. There is no concept of packages in the C++ specification. The concept of packaging is usually left to the compiler or IDE. I just started developing in C and have the same background as you have.
Linux distributions like Ubuntu, Debian, Mint, Kalie, RHEL, CentOS etc. can use the pip tool in order to manage Python packages.
There seem to be a few though I've never used them.
dds https://github.com/vector-of-bool/dds
cpm http://www.cpm.rocks/
conan https://conan.io/
pacm http://sourcey.com/pacm/
spack https://spack.io
buckaroo http://buckaroo.pm
hunter https://github.com/ruslo/hunter
vcpkg https://github.com/Microsoft/vcpkg
Conan is the clear winner today based on its 36+ GitHub contributors and the fact I found their Getting Started documentation to be easy enough to get working. It's MIT licensed too.
Conan's documentation even compares it to biicode which I was surprised wasn't mentioned in other answers, but biicode seems to be abandoned much like cpm.
pacm has some activity but is LGPL which may be an issue for some projects.
This builds on user3071643's answer, thanks!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With