1

I want to use poisson_distribution template in my C++ code (included in random header), but cant find a way to compile it without error

My codeblocks shows an 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.

I remember while installing codeblocks I installed only gnu c/c++ compiler. Can anyone explain me how to update my compiler to standard ISO C++ 2011 standard or suggest an alternative.

Thanks in advance...

M.M
  • 138,810
  • 21
  • 208
  • 365
Akash Chandwani
  • 550
  • 1
  • 9
  • 20

3 Answers3

3

You don't need to update the compiler. You just need to set it to C++11 mode.

How can I add C++11 support to Code::Blocks compiler?

Community
  • 1
  • 1
coyotte508
  • 9,175
  • 6
  • 44
  • 63
  • 3
    Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Toby Speight Jul 17 '17 at 16:24
2

A simple option would be to write

-std=c++11

As part of the other compiler options flags or directly in your Makefile.

Note that some projects may require -std=gnu++11 which is like C++11 but has some GNU extensions enabled.

Joe
  • 2,386
  • 1
  • 22
  • 33
0

Settings > Compiler > select the checkbox: 'Have g++ follow the C++11 ISO C++ language standard'

Ramisa Anjum Aditi
  • 734
  • 1
  • 6
  • 11