Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is g++'s -pthread equiv in clang?

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.

like image 879
anon Avatar asked Mar 06 '10 03:03

anon


2 Answers

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
$
like image 56
vy32 Avatar answered Nov 08 '22 16:11

vy32


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

like image 14
N 1.1 Avatar answered Nov 08 '22 14:11

N 1.1