C++17 support in CLion

Answered

Hello,

I am trying to use C++17 in CLion but it's not clear what is supported and what is not. This page gives some insight but I feel like it's missing features. For instance I want to use std::byte, but this page doesn't list it. When using Clang 6.0 in CLion's toolchain − which according to this supports std::byte − it won't build ("no member named 'byte' in namespace 'std'"). Moreover, even if it built, I wonder if CLion's language engines would properly recognized std::byte in the editor because those don't seem to be configurable.

So on what CLion's C++17 support depends, and how can we have a better overview of the situation than the page listed above provides?

I am using CLion 2018.2, CMake 3.12 with set(CMAKE_CXX_STANDARD 17), and Clang 6.0 as the C++ compiler on Ubuntu 16.04.

0
3 comments

Hello! I can't reproduce the issue in CLion 2018.2.4 on macOS with Clang 6:

Given the fact that in your case the project can't be build, it looks like the compiler you use doesn't really support std::byte. And therefore CLion doesn't recognize it when you use this compiler in CLion.

Can you build the project outside CLion (using terminal)?

0
Avatar
Permanently deleted user

Hello Anna, thanks for your reply.

That was indeed the right thing to do: building outside of CLion wouldn't work either. I realized that despite Clang 6 being installed, it was probably missing libc++ 7 (likely to happen on Ubuntu 16.04 or older). I ended up switching to GCC 7 which can be obtained from a ppa. Using GCC 7 with CLion resolved the problem. More info:

Thanks!

0

Jean-marie, I'm glad you solved the issue! And thank you for sharing the links.

0

Please sign in to leave a comment.