<div dir="ltr"><div>Hello,</div><div><br></div><div>I am trying to compile some software that uses `std::optional`, which from reading a few sites means I need a compiler that supports "C++17" or ISO C++ 2017 standard.  So I installed clang-6.0 on a clean install of ubuntu/xenial using the packages from <a href="http://llvm.org">llvm.org</a>, but no luck.  I am guessing I am using clang incorrectly or there is something wrong with my setup.  In general is the easiest way at the moment to get a working Clang "C++17" dev environment running on Linxu/Ubuntu?  Apologies if this is an FAQ, but searching through the archive I could not find a simple answer.</div><div><br></div><div><a href="http://clang.llvm.org/cxx_status.html#cxx17">http://clang.llvm.org/cxx_status.html#cxx17</a></div><div><br></div><div>"You can use Clang in C++17 mode with the -std=c++17 option (use -std=c++1z in Clang 4 and earlier)."</div><div><br></div><div>Test program:</div><div><br></div><div>```test.cpp</div><div>#include <optional></div><div>int main()</div><div>{</div><div>    std::optional<int> o1;</div><div>}</div><div>```</div><div><br></div><div>Error I am having below. I tried with a few different flags but always with the same failure.</div><div><br></div><div>```</div><div>$ clang++-6.0 -std=c++17 -o test.o test.cpp </div><div>test.cpp:1:10: fatal error: 'optional' file not found</div><div>#include <optional></div><div>         ^~~~~~~~~~</div><div>1 error generated.</div><div>```</div><div><br></div><div>Clang version and linkage info. </div><div><br></div><div>```</div><div>$ clang++-6.0 --version</div><div>clang version 6.0.1-svn334776-1~exp1~20180826122732.96 (branches/release_60)</div><div>Target: x86_64-pc-linux-gnu</div><div>Thread model: posix</div><div>InstalledDir: /usr/bin</div><div><br></div><div>$ ldd /usr/bin/clang++-6.0</div><div><span style="white-space:pre">      </span>linux-vdso.so.1 =>  (0x00007fff2fd42000)</div><div><span style="white-space:pre">  </span>libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff503e99000)</div><div><span style="white-space:pre">      </span>libLLVM-6.0.so.1 => /usr/lib/x86_64-linux-gnu/libLLVM-6.0.so.1 (0x00007ff500365000)</div><div><span style="white-space:pre">        </span>libjsoncpp.so.1 => /usr/lib/x86_64-linux-gnu/libjsoncpp.so.1 (0x00007ff500134000)</div><div><span style="white-space:pre">  </span>libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff4ffdb2000)</div><div><span style="white-space:pre">    </span>libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff4ffaa9000)</div><div><span style="white-space:pre">  </span>libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff4ff893000)</div><div><span style="white-space:pre">  </span>libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff4ff4c9000)</div><div><span style="white-space:pre">  </span>/lib64/ld-linux-x86-64.so.2 (0x00007ff5040b6000)</div><div><span style="white-space:pre">      </span>libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007ff4ff2c1000)</div><div><span style="white-space:pre">  </span>libedit.so.2 => /usr/lib/x86_64-linux-gnu/libedit.so.2 (0x00007ff4ff089000)</div><div><span style="white-space:pre">        </span>libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff4fee6f000)</div><div><span style="white-space:pre">  </span>libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff4fec6b000)</div><div><span style="white-space:pre">        </span>libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007ff4fea42000)</div><div><span style="white-space:pre">  </span>libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007ff4fe82d000)</div><div>```</div><div><br></div><div>Package source:</div><div><br></div><div>```</div><div># install latest clang version (currently 6.0)</div><div># <a href="https://blog.kowalczyk.info/article/k/how-to-install-latest-clang-6.0-on-ubuntu-16.04-xenial-wsl.html">https://blog.kowalczyk.info/article/k/how-to-install-latest-clang-6.0-on-ubuntu-16.04-xenial-wsl.html</a></div><div>curl -L <a href="https://apt.llvm.org/llvm-snapshot.gpg.key">https://apt.llvm.org/llvm-snapshot.gpg.key</a> | sudo apt-key add -</div><div>sudo apt-add-repository "deb <a href="http://apt.llvm.org/xenial/">http://apt.llvm.org/xenial/</a> llvm-toolchain-xenial-6.0 main"</div><div>sudo apt-get update</div><div>sudo apt-get install -y clang-6.0</div><div>```</div><div><br></div><div>Thank you for any hints!</div><div><br></div><div>Milan</div><div><br></div></div>