Demystifying gcc under lpthreads

Posted by Berkay on Stack Overflow See other posts from Stack Overflow or by Berkay
Published on 2010-05-18T21:44:21Z Indexed on 2010/05/18 21:50 UTC
Read the original article Hit count: 361

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about gcc

Related posts about c