agam
agam

Reputation: 5364

How do I try out the new `<execution>` header on OSX?

Saw the <execution> header on cppreference, and wanted to try it out.

Here's what I've tried so far:

Installed versions:

$ /usr/local/opt/llvm/bin/clang++ --version
clang version 7.0.0 (tags/RELEASE_700/final)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin


$ cmake --version
cmake version 3.13.20181204-gb8db7

I thought I might have got cmake flags wrong, so tried compiling directly; here's an isolated one-liner that should work:

CPPFLAGS="-I/usr/local/opt/llvm/include" LDFLAGS="-L/usr/local/opt/llvm/lib" /usr/local/opt/llvm/bin/clang++ -std=c++17 foo.cpp

And here's the (stubborn!) error I keep getting:

fatal error: 'execution' file not found

The line it's complaining about: #include <execution>

Any clues are much appreciated!

Edit: I see the header is missing from /usr/local/opt/llvm/include/c++, so of course it can't work with what I have (and doesn't seem to be present within experimental either), is there another recommended way to install this on osx?

Upvotes: 2

Views: 1687

Answers (1)

agam
agam

Reputation: 5364

To answer my own question:

I was missing an explicit -std=c++17 flag (interestingly, -std=c++2a doesn't work! Which may be okay, but a bit surprising if you expect that mode to be a superset of the c++17 mode)

Anyway, I can confirm that the following works for me just fine:

CPPFLAGS="-I/usr/local/opt/llvm/include" \
LDFLAGS="-L/usr/local/opt/llvm/lib" \
/usr/local/opt/llvm/bin/clang++ \
-std=c++17 \
foo.cpp

Upvotes: 3

Related Questions