GCC Compiler Errors And How To Fix Them

Article by:
Date Published:
Last Modified:

undefined reference to `pthread_create'

This error usually occurs when trying to compile C++ code which uses threads on Linux. This error can usually be fixed by adding the option -pthread to the call to g++, e.g.:

1
$ g++ -pthread main.cpp

Authors

Geoffrey Hunter

Dude making stuff.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License .

Related Content:

Tags

comments powered by Disqus