Question:
In other higher-level and interpreted languages, over time, a "de facto" package manager has been established, sometimes after struggles between various options:
Answer:
Package manager on the client side
The languages you mention are all interpreted and that is an important detail.
In interpreted languages, you have to send the source code to the client, since it will be the interpreter installed on your machine that processes the script that shapes the program.
In compiled languages, the situation changes since the final client receives an executable binary code instead of the source code.
And why is this detail important? Well, the reasons are several:
- The binary code is sensitive not only to the Operating System where it is going to be executed. A binary for Windows will not work on Linux
- The binary code may not work on different versions of the same Operating System. In fact many modern applications (if not almost all) that are in Windows, will not start in a Windows 95.
- Binary code is more restrictive than source code. The size of the objects and the interface of the functions and APIs is burned into the binary code, so you cannot attach any DLL to a binary.
And broadly speaking, these reasons, plus some other that I haven't remembered, are the reasons why you can't find package managers in compiled languages like C, C++, pascal, …
Package manager on developer side
A problem that we usually find when working in C / C++ is that there are numerous compilers even for the same Operating System. This is usually a drawback since each compiler does certain tasks in its own way and this means that the libraries of different compilers may not be compatible with each other.
And then there is the issue of dependencies. In interpreted languages, external dependencies are counted on the fingers of one hand, but in the particular case of, at least, C/C++, things change and in this case the dependencies can be quite varied. And of course, the problem of dependencies here is the issue of licenses… certain licenses force you to publish the source code of your application while other licenses can prevent you from distributing your executable without going through the checkout… the issue of licenses is a world.
However, you can find integrated package managers in certain IDEs. In these cases two things can happen:
- Make the IDE universal. Here only the source code of the libraries could be downloaded. This is usually the most common option.
- The IDE only works with one compiler. In that case, it is possible that it will give you the option to download already compiled libraries, which can save you a lot of time.
The drawback is that they are solutions at the IDE level, so if you change the IDE, the options available to you will surely change. Of course, it is likely that these managers offer you versions of old libraries (keeping the managers up to date consumes time and money), so if your idea is to work with the latest version, it is likely that you will have to download and compile the libraries by hand.
One last option you have is to work with cmake. This project manager, given some time and effort, can do wonders for package management. Other Xmake can also be useful, but I would personally prefer cmake (for example, you have qmake, but this system is linked to Qt).
conclusion
Ultimately I would say that there is no package manager in C/C++. At least not universally.
Yes there are some solutions in that line, but they are dependent on the IDE or a particular framework.