C++ ';最小值';:不是Transdom的成员和其他编译器错误
将C++ ';最小值';:不是Transdom的成员和其他编译器错误,c++,visual-studio,visual-studio-2012,compiler-errors,C++,Visual Studio,Visual Studio 2012,Compiler Errors,将transdom类添加到我的项目后,我开始收到这些错误: 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'
transdom
类添加到我的项目后,我开始收到这些错误:
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
现在我的项目中甚至没有这个类(因为我删除它是为了找出原因),但我仍然得到了这些。我认为这可能是一种bug,因为即使我不再有这个TRandom
类,最后一个错误仍然提到它。我正在使用MS Visual Studio 2012
以防万一,我还粘贴了我的transdom
类的代码:
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);
}
#包括“stdafx.h”
#包括“TRandom.h”
使用名称空间std;
//使用名称空间tr1;
mt19937 transdom::twister=mt19937();
TRandom::TRandom(void)
{
}
TRandom::~TRandom(void)
{
}
int-TRandom::randomInt(int-max,int-min)
{
//mt19937捻线机;
均匀分布距离(最大值、最小值);
回程距离(捻线器);
}
双传输::随机双(双最大值,双最小值)
{
//mt19937捻线机;
均匀实分布距离(最大、最小);
回程距离(捻线器);
}
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
#如果!已定义(_transdom_H)
#定义传输
#包括
类传输
{
私人:
静态std::tr1::mt19937捻线机;
公众:
转移(无效);
~TRandom(void);
静态int randomInt(int max,int min);
静态双随机双(双最大值,双最小值);
};
#endif/\u transdom\u H
请将代码包含在TRandom.h中
错误提到了一行\u Ty1
并且您粘贴的代码中没有这样的东西这里有一个包含min
@IvayloStrandjev的windows宏问题是我的类中或代码中的任何地方都没有“\u Ty1”。实际上,只要修复第一个错误,其余的可能会消失,与系统头(xutility)中的min
@IvayloStrandjev无关。