I am writing a simple C ++ program (learning) and then when I compiled it in the IDE, I got this error test in the header file (name in the question header). How to fix? I read about the license and I do not understand the reason. The error appeared immediately after adding the <random> library to the program <random>

 // Copyright (C) 2007-2014 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/c++0x_warning.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iosfwd} */ #ifndef _CXX0X_WARNING_H #define _CXX0X_WARNING_H 1 #if __cplusplus < 201103L #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. #endif #endif 
  • And what exactly is not clear from the warning text? "This file requires support from the ISO C ++ 2011 standard compiler and library. This support is experimental and should be included with the -std=c++11 or -std=gnu++11 compiler switches " - PinkTux
  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

2 answers 2

How to make my code :: blockes support C ++ 11?

Code :: Blocks by itself does not support anything, support is needed from the compiler. It is configured, obviously, in the same place, where other options of the compiler, in the English version it is Settings->Compiler...

enter image description here

  • Well, the checkbox Have g++ follow the C++11 ISO C++ language standard [-std=c++11] is clearly visible. It should be noted ... - Harry
  • Thanks, now everything works) - Max

You were clearly written - your compiler does not support C ++ 11 by default, so you have to specify an additional key when compiling such things - -std=c++11 or -std=gnu++11 ...

  • I use code :: blocks for development. Do you happen to know how to make my code :: blockes support C ++ 11? - Max
  • Frankly, no. But in any environment in the settings of the project somewhere there is such a fad - setting compilation parameters. Either directly allows you to specify a key, or there will be something like an option to use the standard c ++ 11 ... - Harry