2

I want to learn how to use boost library,and I install boost successfully.So I write a program like this.

#include "stdafx.h"
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int.hpp>
#include <boost/random/variate_generator.hpp>
int main(){
    boost::mt19937 gen;
    boost::uniform_int<>distribut(1, 10);
    boost::variate_generator<boost::mt19937 &, boost::uniform_int<>> die(gen, distribut);
    int x = die();
    return 0;
}

But it shows that 1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\xutility(2715): error C4996: 'std::_Fill_n': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'

And it only happens when I include the file boost/random/mersenne_twister.hpp. So I want to know how to handle this problem? If I need to use D_SCL_SECURE_NO_WARNINGS,how do I use it? Thanks.

Aqeel Abbas
  • 159
  • 4
  • 13
kunyang
  • 61
  • 5
  • a web site may be helpful:https://svn.boost.org/trac/boost/ticket/11426 but I do not know how to change the code even after reading the article. – kunyang Jan 16 '16 at 16:10
  • 1
    See [What does "use -D_SCL_SECURE_NO_WARNINGS" mean?](http://stackoverflow.com/questions/25046829/what-does-use-d-scl-secure-no-warnings-mean) – Bo Persson Jan 16 '16 at 16:52

0 Answers0