yeah, forgot to post to newsgroup. sorry. Kai, what is this? is this
compiler
bug or user error? the compiler shouldn't be complaining about its own code
like this should it? or am I doing something wrong? I think I followed the
manual correctly from dinkum (which says nothing about namespaces).
I did find an example that works.
http://www.codeguru.com/cpp/cpp/cpp_mfc/stl/article.php/c15319
________________________________
From: Jim Michaels <[email protected]>
To: K. Frank <[email protected]>
Sent: Tue, January 25, 2011 3:56:07 PM
Subject: Re: [Mingw-w64-public] problem with tr1/random?
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();
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
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/random:59,
from createfl.cpp:67:
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.tcc:
In member function 'void std::tr1::mersenne_twister<_UIntType, __w, __n, __m,
__r, __a, __u, __s, __b, __t, __c, __l>::seed(_Gen&, std::tr1::false_type)
[with
_Gen = std::tr1::random_device(), _UIntType = long unsigned int, int __w = 32,
int __n = 624, int __m = 397, int __r = 31, _UIntType __a = 2567483615ul, int
__u = 11, int __s = 7, _UIntType __b = 2636928640ul, int __t = 15, _UIntType
__c
= 4022730752ul, int __l = 18]':
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:583:
instantiated from 'void std::tr1::mersenne_twister<_UIntType, __w, __n, __m,
__r, __a, __u, __s, __b, __t, __c, __l>::seed(_Gen&) [with _Gen =
std::tr1::random_device(), _UIntType = long unsigned int, int __w = 32, int __n
= 624, int __m = 397, int __r = 31, _UIntType __a = 2567483615ul, int __u = 11,
int __s = 7, _UIntType __b = 2636928640ul, int __t = 15, _UIntType __c =
4022730752ul, int __l = 18]'
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:571:
instantiated from 'std::tr1::mersenne_twister<_UIntType, __w, __n, __m, __r,
__a, __u, __s, __b, __t, __c, __l>::mersenne_twister(_Gen&) [with _Gen =
std::tr1::random_device(), _UIntType = long unsigned int, int __w = 32, int __n
= 624, int __m = 397, int __r = 31, _UIntType __a = 2567483615ul, int __u = 11,
int __s = 7, _UIntType __b = 2636928640ul, int __t = 15, _UIntType __c =
4022730752ul, int __l = 18]'
createfl.cpp:1373: instantiated from here
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.tcc:209:
error: no matching function for call to '__mod(std::tr1::random_device)'
________________________________
From: K. Frank <[email protected]>
To: mingw64 <[email protected]>
Sent: Tue, January 25, 2011 3:19:25 PM
Subject: Re: [Mingw-w64-public] problem with tr1/random?
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]
Good luck.
K. Frank
------------------------------------------------------------------------------
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
------------------------------------------------------------------------------
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