Hello MinGW and mingw64! Sorry -- the below went to MinGW by mistake. I'm copying it to mingw64, where the thread started.
K. Frank On Tue, Jan 25, 2011 at 7:59 PM, K. Frank <[email protected]> wrote: > Hi Jim! > > Well this round of errors is, as the say, a whole nother kettle > of fish! > > On Tue, Jan 25, 2011 at 6:56 PM, Jim Michaels <[email protected]> wrote: >> oh, I forgot to tell you, I had the line, using namespace std; >> #include <tr1/random> >> using namespace std; >> //do mersenne twister random number generator >> std::tr1::random_device rd(); > > I think this line is your problem: > > std::tr1::random_device rd(); // <-- trouble! > > This declares a function (called rd) that returns a > random_device. It does not default-construct an > instance of a random_device. > > This is a common and pernicious c++ pitfall. Scott > Meyers calls it "c++'s most vexing parse." There's > a faq for it: > > http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.2 > > Best > > > K. Frank > > >> std::tr1::mt19937 eng(rd); >> std::tr1::uniform_int<> unif(0x00, 0xff); >> unif(eng); //get random number >> >> note the last line of the error messages. >> >> In file included from >> c:\mingw-w64-bin_i686-mingw_20101003_sezero\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.4.5/../../../../x86_64-w64-mingw32/include/c++/4.4.5/tr1_impl/random:2407, >> ... >> >> From: K. Frank <[email protected]> >> >> Hello Jim! >> >> On Tue, Jan 25, 2011 at 5:38 PM, Jim Michaels <[email protected]> wrote: >>> #include <tr1/random> >>> >>> //mersenne twister random number generator >>> random_device rd(); >>> mt19937 eng(rd); >>> uniform_int<> unif(0x00, 0xff); >>> data=unif(eng);//get a random number >>> >>> using personal build sezero, I get: >>> createfl.cpp:1372: error: 'random_device' was not declared in this scope >>> createfl.cpp:1372: error: expected ';' before 'rd' >>> createfl.cpp:1373: error: 'mt19937' was not declared in this scope >>> createfl.cpp:1373: error: expected ';' before 'eng' >>> createfl.cpp:1374: error: 'uniform_int' was not declared in this scope >> >> It looks to me like the "not declared" errors are for symbols in >> the std::tr1 namespace. >> >> Try changing "random_device" to "std::tra::random_device", and >> so on. >>> ... >>> Jim Michaels >>> [email protected] >> ... > ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
