Ubuntu – how to compile a c program that uses pthread.h

c

I'm a beginner and I'm new to Ubuntu. I just installed it and want to run a C program. I have no idea what platform to use or where to write the code. I need to use pthread.h header file in the program. Can anyone help me?

Best Answer

Use:

gcc MyProgram.c -o MyProgram -lpthread 

and dont forget to include the POSIX library in your code. It will compile your code.

Related Question