Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is the linux command that gives the paths to link libraries in c++ compilation?

I remember seeing some command that works like this:

g++ main.cpp `some_forgotten_command --some_forgotten_options some_library`

When the command is run, it will substitute the part enclosed by “ with -I/path/to/some_library/include and -L/path/to/some_library/lib/ (or something similar, I don’t remember exactly). However I could not remember what some_forgotten_command is.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It’s pkgconf or pkg-config (those are two different implementations that do mostly the same thing).

pkgconf --libs LibraryName gives linker flags, and pkgconf --cflags LibraryName gives compiler flags.

You can use both --libs and --cflags in the same command (in your specific example, since you do compilation and linking together in a single command, you should use both).

And pkgconf --list-all prints a list of all installed library names.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading