ctor 错误函数已定义且具有不同类型的 c++ 或 mql
ctor error function already defined and has different type c++ or mql
我用 ctor 定义 class 并在我的代码中使用它,但编译器给我错误
class MovingAvrage_Expert
{
public:
MovingAvrage_Expert(void);
~MovingAvrage_Expert(void);
bool Init(void);
double TradeSizeOptimized(void);
void CheckForOpen(void);
void CheckForClose(void);
bool SelectPosition();
}
MovingAvrage_Expert::MovingAvrage_Expert(void)
{
}
MovingAvrage_Expert::~MovingAvrage_Expert(void)
{
}
... more function
MovingAvrage_Expert maExpert;
// MQL Function
int OnInit(void)
{
if (!maExpert.Init())
{
printf("Error creating indicator");
return (INIT_FAILED);
}
return (INIT_SUCCEEDED);
}
void OnTick(void)
{
if (maExpert.SelectPosition())
maExpert.CheckForClose();
else
maExpert.CheckForOpen();
}
我的错误
'MovingAvrage_Expert' - function already defined and has different
type Expert Advisors.mq5 48 22
我的问题在哪里?
只是应该写;在 class
之后
class MovingAvrage_Expert
{
public:
MovingAvrage_Expert(void);
~MovingAvrage_Expert(void);
bool Init(void);
double TradeSizeOptimized(void);
void CheckForOpen(void);
void CheckForClose(void);
bool SelectPosition();
};
:)
我用 ctor 定义 class 并在我的代码中使用它,但编译器给我错误
class MovingAvrage_Expert
{
public:
MovingAvrage_Expert(void);
~MovingAvrage_Expert(void);
bool Init(void);
double TradeSizeOptimized(void);
void CheckForOpen(void);
void CheckForClose(void);
bool SelectPosition();
}
MovingAvrage_Expert::MovingAvrage_Expert(void)
{
}
MovingAvrage_Expert::~MovingAvrage_Expert(void)
{
}
... more function
MovingAvrage_Expert maExpert;
// MQL Function
int OnInit(void)
{
if (!maExpert.Init())
{
printf("Error creating indicator");
return (INIT_FAILED);
}
return (INIT_SUCCEEDED);
}
void OnTick(void)
{
if (maExpert.SelectPosition())
maExpert.CheckForClose();
else
maExpert.CheckForOpen();
}
我的错误
'MovingAvrage_Expert' - function already defined and has different type Expert Advisors.mq5 48 22
我的问题在哪里?
只是应该写;在 class
之后class MovingAvrage_Expert
{
public:
MovingAvrage_Expert(void);
~MovingAvrage_Expert(void);
bool Init(void);
double TradeSizeOptimized(void);
void CheckForOpen(void);
void CheckForClose(void);
bool SelectPosition();
};
:)