I worked with SFML, I compiled a small test program and added a link -lsfml-audio. Then I used ldd ./programto browse the dynamic libraries to which it was bound. Surprisingly, there were many, none of them were manually selected in my makefile, nor were they used pkg-config --libs.
I started reading about shared libraries and made a small example to resolve my doubts. However, I have this question:
why do some libraries need you to add dependencies to your makefile (either manually or using a script like pkg-config) and other libraries automatically link their dependencies?
When you create your own dynamic library, it is as easy as adding the right parameters -ldependencyto the command g++ -shared ...to avoid unnecessary attempts to manually add dependencies. Why don't many of the available libraries do this?
I suppose this should be due to the fine-tuning ability that libraries are associated with, etc.
source
share