Demystifying gcc under lpthreads
- by Berkay
in these i'm playing with thread library and trying to implement some functions.
One of the tutorial says that to run the program use :
gcc -lpthread -lrt -lc -lm project1.c scheduler.c -o out
first of all i need deep understanding of what is gcc doing in each line,
lpthread is used for what? what are the contributions of lrt -lc -lm ?
project1.c and scheduler.c is compiled together so what should i understand? i checked
the code and any of them not included in project1.c or scheduler.c.
as an output clearly it gives "out".
secondly the author states that to run the program you have to use
./out number filename (For example, ./out 2 sample.txt)
To make these clear as far as i understand the main function gets number and sample.txt as an input.(?)
thanks for your answers and making me clear.