error: #error This file requires compiler and library support for the ISO C++ 2011 standard

I would like to use #include <unordered_set> in my cpp coding, but it show error when I compile.

error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

Solution

Before you compile, or run do this first.

cmake CMakeLists.txt

Then add this in your CMakeList.txt file

SET(CMAKE_CXX_FLAGS "-std=c++11 -O3")

Then try to compile again. Good Luck.

Tags:

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.