15

I'm switching over from g++ to clang

however, in g++, I have the -pthread flag, which clang does not seem to recognize.

What is the equiv in clang?

EDIT: My clang build is pulling from svn on March 5 2010.

denfromufa
  • 5,610
  • 13
  • 81
  • 138
anon
  • 41,035
  • 53
  • 197
  • 293
  • the link i posted, suggests that clang indeed accepts -pthread. Check if something else is wrong. What error message did you get? – N 1.1 Mar 06 '10 at 03:30

2 Answers2

35

clang requires -pthread when compiling but not when linking. This is annoying, but it is observed behavior:

$ clang -c x.cpp
$ clang -pthread -c x.cpp
$ clang -o x x.o
$ clang -pthread -o x x.o
clang: warning: argument unused during compilation: '-pthread'
$ 

$ clang --version
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
$
vy32
  • 28,461
  • 37
  • 122
  • 246
16

Clang supports -pthread. May be in the latest builds, so update it and try again.

Whisperity
  • 3,012
  • 1
  • 19
  • 36
N 1.1
  • 12,418
  • 6
  • 43
  • 61