1

I was trying to compile some multithreading code on different gcc versions on travis-ci. The versions that were used for the build were: g++ 4.8 and g++ 4.9. The code would refuse to compile without -lpthread on both versions. On adding the -lpthread flag however, they would compile, but when run, the g++ 4.8 code just crashed, while g++ 4.9 seemed to have build the right compilation. Now, when I changed the flag to -pthread on both compilers, both built correctly. I understand, -lpthread links with the C-style thread library, while -pthread causes the compiler to link the correct library, which 'might' not be the C-style thread library. Am I correct? Here's the link to the two build-logs: gcc 4.8 and gcc 4.9.

user2338150
  • 479
  • 5
  • 14

0 Answers0