Update
I narrowed down the problem to (probably! it's not entirely clear, even reading all I could find about the topic) that installing stdlibc++-7-dev
would provide me with suitable (i.e., C++17-compliant) STL headers and libraries.
This (also, apparently) comes bundled with Ubuntu 17.04 (artful
?) but is not available for xenial
(Ubuntu 16.04.3 LTS) which is what I'm using.
I have tried downloading the individual .deb
packages and installing them, but it quickly becomes a maze of unresolved dependencies.
If anyone could point me to how to install libstdc++-7-dev
on 16.04, I'd be most grateful.
Original question
I have just installed clang++ 6.0 in Ubuntu 16.04 via the package manager (following these instructions) and all seems well: /usr/bin/clang++-6.0
works just fine, and if I try to use something that only works in C++17 (non-type template arguments with auto
, see here) it compiles and runs, once I set CMAKE_CXX_COMPILER=/usr/bin/clang++-6.0
-- while it fails when I don't.
So... clang 6.0
understands C++17 as advertised (doh!) but when I use:
#include <variant>
the file is not found where I would expect it to be:
$ ll /usr/include/clang/6.0.0/
total 0
lrwxrwxrwx 1 root root 45 Aug 6 21:32 include -> ../../../lib/llvm-6.0/lib/clang/6.0.0/include
or anywhere else I can think of.
Would anyone know (a) whether it's supposed to be there at all and (b) if so, where do I go find it?
Update
I have double-checked that I have the latest (I think) stdc++
library:
$ sudo apt-get install libstdc++-5-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libstdc++-5-dev is already the newest version (5.4.0-6ubuntu1~16.04.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
and same for libstdc++-6-dev
; also, I have libc++-dev
:
$ sudo apt-get install libc++-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libc++-dev is already the newest version (3.7.0-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Still, the variant.h*
file is nowhere to be found.
Anything else I should try?
-stdlib=libc++
to both the compiler and the linker. – Binocularc++1z
flag (I don't expect this to change until the standard is ratified). I think they've switched to 6 in development as they're getting ready to release 5. – Binocular<experimental/variant>
. That's what I was doing with<optional>
, before I updated my compiler – Toshiatoshiko/usr/include/c++/5/experimental/
which seems to be the bits supporting C++14 - still novariant
header in that folder, but now I'm guessing it's a case of tracking down which package adds the header files for the STL to support C++17 – Accusative<experimental/variant>
. – Replicastring_view
is part of the standard now andexperimental/string_view
is from TS. – Epirus