Have you ever seen this error message

  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.

before when you are running

  cmake CMakeLists.txt

command in a C++ project?

You are in luck. In this short tutorial, we are going to show you guys how to solve this issue.

You simply need to add the following line of code into your CMakeLists.txt file and it should works now.

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

Tada. Your project should build successfully now =)

Wrapping Up

Hopefully this guide has help you to make the error message goes away. Thank you for reading!


I’ll try to keep this list current and up to date. If you know of a great resource you’d like to share or notice a broken link, please let us know.

Getting started