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.