Tain Kim
Tain Kim

Reputation: 1

c++: error: unrecognized command line option ‘-std=c++17’

[ 25%] Building CXX object CMakeFiles/linreg-dlib.dir/linreg_dlib.cc.o
/usr/bin/c++   -I/home/jeong/다운로드/dlib-master -I"/home/jeong/바탕화면/9781789955330_Code/Chapter01/dlib_samples/path to dlib install dir/include"  -std=c++17 -msse3 -fopenmp -Wall -Wextra   -o CMakeFiles/linreg-dlib.dir/linreg_dlib.cc.o -c /home/jeong/바탕화면/9781789955330_Code/Chapter01/dlib_samples/linreg_dlib.cc
c++: error: unrecognized command line option ‘-std=c++17’
make[2]: *** [CMakeFiles/linreg-dlib.dir/linreg_dlib.cc.o] error 1
make[2]: Leaving directory `/home/jeong/바탕화면/9781789955330_Code/Chapter01/dlib_samples'
make[1]: *** [CMakeFiles/linreg-dlib.dir/all] error 2
make[1]: Leaving directory `/home/jeong/바탕화면/9781789955330_Code/Chapter01/dlib_samples'
make: *** [all] error 2

c++: error: unrecognized command line option ‘-std=c++17’ I am running the practice code using the dlib library. It runs until'cmake', but the above error appears during'make' process. Need to update gcc?

The gcc version is shown below. gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)

How to do it if you need to update the version I wonder.

Upvotes: 0

Views: 11536

Answers (2)

Magnus Bengtsson
Magnus Bengtsson

Reputation: 21

As others have mentioned your compiler is too old for C++17.

It sounds like you are on either RHEL 7 or CentOS 7. Those OSes support installation of "Developer Toolsets" with newer versions of the compiler and toolchain (in addition to the standard system compiler). This might be an option for you.

For RHEL 7 see: https://access.redhat.com/documentation/en-us/red_hat_developer_toolset/10/

For CentOS see: https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/

Upvotes: 2

Marshall Clow
Marshall Clow

Reputation: 16680

The GCC releases page (https://www.gnu.org/software/gcc/releases.html) says that gcc 4.8.5 was released on June 23, 2015.

The GCC developers are really good, but shipping C++17 support two years before C++17 was completed is beyond good.

That compiler may support -std=c++1z for some C++17 features, though.

Upvotes: 2

Related Questions