【发布时间】:2020-06-05 18:46:42
【问题描述】:
我正在使用 RHEL 7.5 并尝试编译 uWebSocket (This exaple) 代码。我克隆项目并打开它。当我在 Makefile 上启动 make 时,出现此错误;
BroadcastingEchoServer uSockets/*.o -lz;
g++: error: unrecognized command line option '-std=c++17'
make: [examples] Error 1>
主要问题是-std=c++17无法识别。如何控制我拥有的 c++ 版本(最终是 17 个)以及如何安装所需的版本。
gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
谢谢
【问题讨论】:
-
gcc.gnu.org/projects/cxx-status.html#cxx1z "从 GCC 5 开始提供 C++17 功能。要启用 C++17 支持,请将命令行参数 -std=c++17 添加到 g++ 命令行。或者,要启用除 C++17 功能之外的 GNU 扩展,请添加 -std=gnu++17。”你可以试试:sudo yum install g++5.0.