【发布时间】:2018-10-02 08:53:57
【问题描述】:
我想在 eclipse photon 上使用来自 c++17 的 #include <cstddef> 和 std::byte。我已将项目配置为使用 c++17 >> project >> properties >> C/C++ Build >> settings >> GCC C++ Compiler >> Dialect >> Other dialect flags >> -std=c++17 进行编译,并且我也尝试过 -std=c++1z。我下面的程序可以使用<cstddef> 库,但是std::byte 的行无法编译。 Eclipse 说Type 'std::byte' could not be resolved。
如何让 eclipse 支持 C++17?
#include <cstddef>
int main(void) {
std::byte myByte { 2 };
}
谢谢
【问题讨论】:
-
Type 'std::byte' could not be resolved是编译器错误还是 Eclipse 消息?哪个编译器+版本?哪个eclipse版本? -
这是一条日食消息。我的eclipse版本是
Eclipse IDE for C/C++ Developers Version: Photon Release (4.8.0) -
尝试直接使用该程序调用 gcc,如果它有效,请告诉我们。
g++ --version和g++ -std=c++17 byte.cpp或g++ -std=c++1z byte.cpp。 -
好的,
g++ --version命令输出让我感到困惑。它输出g++ (Ubuntu 6.4.0-17ubuntu1~16.04) 6.4.0 20180424。那么,我实际使用的是哪个 C++ 版本?