Enable C++17 on Eclipse to Use `Std: :Byte`

I want to use #include <cstddef> and std::byte from c++17 on eclipse photon. I have configured the project to compile using c++17 >> project >> properties >> C/C++ Build >> settings >> GCC C++ Compiler >> Dialect >> Other dialect flags >> -std=c++17 and I have also tried -std=c++1z. My program below can use <cstddef> library, but the line with std::byte does not compile. Eclipse says Type 'std::byte' could not be resolved. How do I make eclipse support C++17?

#include <cstddef>

int main(void) {
    std::byte myByte { 2 };
}

Thanks

10

2 Answers

I use (eclipse 4.7.3a and gcc 7.3.0 MinGW-W64). And C++17 works fine with flag --std=c++1z

project >> properties >> C/C++ Build >> settings >> GCC C++ Compiler >> Dialect >> Other dialect flags >> --std=c++1z
0

According to ,std::byte is only supported since gcc 7.

Try upgrade your gcc version

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest