undefined reference to `pthread_key_create’ (linker error)

You need to specify -pthread after -lgtest. The linker takes libraries in order, and only takes as much as it needs to resolve references which are undefined at that point.

Leave a Comment