`pkg-config --cflags --libs glib-2.0" -lpthread
Hi
I would be great full to all of you If anyone could explain me these options while compiling. gcc -o test thread.c `pkg-config --cflags --libs glib-2.0" -lpthread |
Quote:
You might look at Code:
man gcc -o: output binary file pkg-config: program to output details, libraries etc to compile a program so that you don't have to type them all out manually. --cflags This prints pre-processor and compile flags required to compile the packages on the command line, including flags for all their dependencies. Flags are "compressed" so that each identical flag appears only once. pkg-config exits with a nonzero code if it can't find metadata for one or more of the packages on the command line. --libs This option is identical to "--cflags", only it prints the link flags. As with "--cflags", duplicate flags are merged (maintaining proper ordering), and flags for dependencies are included in the output. -lpthread: link to library pthread during compile time. Also, take a look at the output for: Code:
pkg-config --cflags --libs glib-2.0 |
And it's probably better to use $(command) instead of backticks.
|
Thanks
Thanks a lot
Now I have clear picture of it. But still having a doubt.... In man pkg-config it is saying like --cflags This prints pre-processor and compile flags required to compile the packages on the command line, including flags for all their dependencies. Flags are "compressed" so that each identical flag appears only once. Where actually it prints the flag?? Might be it is ridiculous question but I want to ask you. |
It just prints them.
$() and backticks capture a program's output and paste it in instead of the $() or backticks. |
All times are GMT -5. The time now is 12:03 AM. |