Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED] What is the purpose of the last parameter?

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
User avatar
edbarx
Posts: 5401
Joined: 2007-07-18 06:19
Location: 35° 50 N, 14 º 35 E
Been thanked: 2 times

[SOLVED] What is the purpose of the last parameter?

#1 Post by edbarx »

I answered my own question.

Could anyone explain to me what is the purpose of the parameter within single quotation marks and what it does? I am assuming it is a call to pkg-config with those paramaters.

Code: Select all

gcc -o gtkprog gtkprog.c `pkg-config --libs --cflags gtk+-2.0`
Using:

Code: Select all

pkg-config --libs --cflags gtk+-2.0
-pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype
So, if my logic serves me right, this command parameter is a neat replacement for this litany of libraries to be used in the compilation process.

Correct me if I am wrong.
Debian == { > 30, 000 packages }; Debian != systemd
The worst infection of all, is a false sense of security!
It is hard to get away from CLI tools.

User avatar
saulgoode
Posts: 1445
Joined: 2007-10-22 11:34
Been thanked: 4 times

Re: [SOLVED] What is the purpose of the last parameter?

#2 Post by saulgoode »

For the most part you are correct, however, it is more than just a simple insertion of the libraries and includes into the command line. pkg-config is part of GNU autotools and it resolves the dependencies of the packages dynamically within the compiler environment at compile time. In your example, it does this by starting with /usr/lib/pkgconfig/gtk+-2.0.pc and recursively checking all of the other packages specified.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian Kernighan

Post Reply