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.
>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.