1

TRandom私のプロジェクトにクラスを追加した後、私はそれらのエラーを受け取り始めました:

Error   1   error C2039: 'result_type' : is not a member of 'TRandom'   e:\programy\microsoft visual studio 11.0\vc\include\xutility    3450
Error   2   error C2146: syntax error : missing ';' before identifier '_Ty1'    e:\programy\microsoft visual studio 11.0\vc\include\xutility    3450
Error   3   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   e:\programy\microsoft visual studio 11.0\vc\include\xutility    3450
Error   4   error C2065: '_Ty1' : undeclared identifier e:\programy\microsoft visual studio 11.0\vc\include\xutility    3452
Error   5   error C2070: ''unknown-type'': illegal sizeof operand   e:\programy\microsoft visual studio 11.0\vc\include\xutility    3452
Error   6   error C2065: '_Ty1' : undeclared identifier e:\programy\microsoft visual studio 11.0\vc\include\xutility    3453
Error   7   error C2923: 'std::_If' : '_Ty1' is not a valid template type argument for parameter '_Ty2' e:\programy\microsoft visual studio 11.0\vc\include\xutility    3453
Error   8   error C2955: 'std::_If' : use of class template requires template argument list e:\programy\microsoft visual studio 11.0\vc\include\xutility    3453
Error   9   error C2039: 'min' : is not a member of 'TRandom'   e:\programy\microsoft visual studio 11.0\vc\include\random  3600

現在、プロジェクトにはそのクラスさえありません(理由を見つけるために削除したため)が、それでもそれらを取得します。TRandomこのクラスはもうありませんが、最後のエラーにはまだ言及されているため、これは何らかのバグである可能性があると思います。MS Visual Studio 2012 を使用しています。

念のため、TRandomクラスのコードも貼り付けます。

Cpp ファイル:

#include "stdafx.h"
#include "TRandom.h"


using namespace std;
//using namespace tr1;

mt19937 TRandom::twister = mt19937();

TRandom::TRandom(void)
{
}


TRandom::~TRandom(void)
{
}


int TRandom::randomInt(int max, int min)
{
    //mt19937 twister;
    uniform_int_distribution<int> dist(max, min);
    return dist(twister);
}

double TRandom::randomDouble(double max, double min)
{
    //mt19937 twister;
    uniform_real_distribution<double> dist(max, min);
    return dist(twister); 
}

H ファイル:

#if !defined(_TRANDOM_H)
#define _TRANDOM_H

#include <random>


class TRandom
{

private:
    static std::tr1::mt19937 twister;

public:
    TRandom(void);
    ~TRandom(void);

    static int randomInt(int max, int min);
    static double randomDouble(double max, double min);
};

#endif //_TRANDOM_H
4

0 に答える 0