Originally Posted by Nagababa
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
I think you have a typo, after glib-2.0 you should have a backtick instead of a double quote.
You might look at
-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.
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.
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:
pkg-config --cflags --libs glib-2.0
This will show you what is being linked to during the compilation process. I know that it seems like a lot, especially if you have a background in Windows programming. In Linux you will learn a lot about the compilation/linking process. pkg-config helps out a lot, you are not forced to use it, but if you don't use it, you will have to type all of the output of the above command into your compilation string.