Compiling and Running

This lesson shows how you can run the code you saw in this chapter locally.

All of the code examples in this chapter are relatively easy to get up and running. To compile them, you must include the header pthread.h in your code. On the link line, you must also explicitly link with the pthreads library, by adding the -pthread flag.

For example, to compile a simple multi-threaded program, all you have to do is the following:

Get hands-on with 1200+ tech skills courses.