Working with c++ libraries in arch system

After many years I am just getting back to c++ programming (back then I had only very little experience) and I am looking for an advice from more experienced c++ developers.

I would like to know if there is some recommended way how to search and install libraries so that I can use them in my projects.
I have some experience with python where it is easy to either pacman -S python-<library-name> or use pip for library management.

For c++ I do not see an obvious way where to get the libraries right now. Is there also some place where I can search for the libraries with specific functionality - handling large data tables, signal processing, TCP/UDP packet sending and processing, sql database quering, …

It looks like c++ tutorials only handle language syntax but not the other important bits and pieces like OS integration and project compiling/building.

This might help

If you find an interesting lib, I would probably just search the arch repos if it’s available as a package.

For UI stuff you might want to look at the qt libs

2 Likes

Most popular libraries are already in the Arch repos or in the AUR. Using them is just a matter of installing the right package, adding the correct #include <...> preprocessor directive, and providing the correct flags to the compiler/linker (usually found in the library documentation).

For smaller libraries that are not in the repos you may want to statically link them in your project. In that case, the simplest thing to do is just download the source of the library, follow the build instructions (if necessary) and add the correct #include "..." preprocessor directive and linker options (if necessary).

Personally, I find this much more elegant than using a third-party package manager like cargo, pip, npm or gem, which generally suck (and specially suck on Arch, where they can conflict with ALPM).

1 Like

@moson That is definitely an useful list, thank you. It is so difficult to know where to start and what is available so I do not have to reinvent the wheel.

Is there some naming convention for them? For example python libraries start with python-, some (all?) C libraries start with lib.

I use this only when I want to create a virtual environment - different packages per project. Not every system package manager supports latest packages (for example *buntu).

Can pacman show what package holds library, executable binary or raw source code? (or is this just totaly stupid question? :innocent:)

There is no consistent naming. For example, for Boost (a popular C++ framework, which I don’t use, because it’s bloat), the runtime libraries are in the package boost-libs but headers (which you #include) are in boost.

You can always do pacman -Fl package_name to list all files provided by that package. If you see .h or .hpp files, those are headers.

1 Like

In Arch, the libs are often included in the main package so it depends what you need.