
This is my first Boost program #include <iostream> #include <cstdlib> #include <boost\random.hpp> using namespace std; using namespace boost; typedef boost::mt19937 BaseGenerator; typedef boost::uniform_real<double> Distribution; typedef boost::variate_generator<BaseGenerator,Distribution> Generator; double boostDoubleRand() { static BaseGenerator base; static Distribution dist; static Generator rng(base,dist); return rng(); } int main() { cout << "expect 5 numbers within the interval [0,1)" << endl; for (int i = 0; i < 5; i++) { cout << boostDoubleRand() << "\n"; } cout << endl; return 0; } Compiled using Borland C++ 5.6.4 and it works well. But when I compile it using MingW GCC, it only prints "expect 5 numbers within the interval [0,1)" and not the 5 random numbers. Why ? --------------------------------- Yahoo! FareChase - Search multiple travel sites in one click.

--- Andre Tampubolon wrote:
Compiled using Borland C++ 5.6.4 and it works well. But when I compile it using MingW GCC, it only prints "expect 5 numbers within the interval [0,1)" and not the 5 random numbers.
Why ?
Are you using an old version of MinGW? The program works correctly when compiled with GCC 3.4.2 (MinGW). Cromwell D. Enage __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

Cromwell Enage <sponage@yahoo.com> wrote: --- Andre Tampubolon wrote:
Compiled using Borland C++ 5.6.4 and it works well. But when I compile it using MingW GCC, it only prints "expect 5 numbers within the interval [0,1)" and not the 5 random numbers.
Why ?
Are you using an old version of MinGW? The program works correctly when compiled with GCC 3.4.2 (MinGW). Cromwell D. Enage I'm using MinGW 3.1.0.1 --------------------------------- Yahoo! Shopping Find Great Deals on Gifts at Yahoo! Shopping

--- Andre Tampubolon wrote:
I'm using MinGW 3.1.0.1
GCC 3.1 is...very old (but not as old as GCC 2.95). GCC 3.4.2 is much more standards-conformant; can you upgrade to it? Cromwell D. Enage __________________________________________ Yahoo! DSL Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com

Cromwell Enage <sponage@yahoo.com> wrote: --- Andre Tampubolon wrote:
I'm using MinGW 3.1.0.1
GCC 3.1 is...very old (but not as old as GCC 2.95). GCC 3.4.2 is much more standards-conformant; can you upgrade to it? Cromwell D. Enage Aah checked my GCC ( gcc -v ) and it says : gcc version 3.2.3 (mingw special 20030504-1) is this old enough ? maybe I should upgrade it anyway... --------------------------------- Yahoo! Personals Single? There's someone we'd like you to meet. Lots of someones, actually. Yahoo! Personals
participants (2)
-
Andre Tampubolon
-
Cromwell Enage