Download MetaTrader 5

Unresolved Static Variable?

To add comments, please log in or register
Clock
1183
Clock  

Hi guys,

can anybody explain, what that sudden error is supposed to mean?

My EA was working flawlessly for months, but since the latest update, I get this error.


In my EA I just declare an array

CMoneyManagement mms[];


and CMoneymanagement has one static variable.

Whats wrong with that?


Thanks in advance,

Clock

Alain Verleyen
Moderator
31182
Alain Verleyen  
Clock:

Hi guys,

can anybody explain, what that sudden error is supposed to mean?

My EA was working flawlessly for months, but since the latest update, I get this error.


In my EA I just declare an array

CMoneyManagement mms[];


and CMoneymanagement has one static variable.

Whats wrong with that?


Thanks in advance,

Clock

Can you please post code and log that demonstrate your issue ?
Clock
1183
Clock  

I can reduce my problem all the way down to

//+------------------------------------------------------------------+
//|                                                       Static.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Dummy Class                                                      |
//+------------------------------------------------------------------+
class CMM
  {
private:
   static double     m_percent;

public:
                     CMM();
                    ~CMM();
   bool   Init(void);
  };
//+------------------------------------------------------------------+
void CMM::CMM()
  {
   Init();
  }
bool CMM::Init(void)
{
   m_percent=0;
   return true;
}
void CMM::~CMM(void)
{
}
//+------------------------------------------------------------------+
//| Define Class Array                                               |
//+------------------------------------------------------------------+
CMM      mms;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
  }
//+------------------------------------------------------------------+


I sure am missing something obvious here, but then again, the code has been working for the last couple months.


Thanks for any advice...

Alain Verleyen
Moderator
31182
Alain Verleyen  
Clock:

I can reduce my problem all the way down to


I sure am missing something obvious here, but then again, the code has been working for the last couple months.


Thanks for any advice...

And what is the error ? The code you provided compiles and runs without problem.
Clock
1183
Clock  

Are you running error-free already with version 837?


Cause since that update, I get the error:

"unresolved static variable 'CMM::m_percent'"

in line 38 / 12, which is exactly the position of the variable "mms".

Alain Verleyen
Moderator
31182
Alain Verleyen  

Ok, you didn't mention that. I am still using build 821.

EDIT : If you don't want such problem, don't use Metaquotes Demo Server, as MT5 is automatically updated during development of new release. I suggest you to wait for official relase of a new build, and if problem is still present then write to ServiceDesk.

Get in touch with developers using Service Desk!
Get in touch with developers using Service Desk!
  • www.mql5.com
We therefore attach great importance to all user reports about issues in our programs and try to answer each one of them.
Clock
1183
Clock  

Thanks for your always fast and helpful comments!

Since my experiences with the Service Desk where rather unsatisfying so far, I was hoping for a quick solution right here. But if it's beta-version related (if you wanna call it that), then I'll have to go the other route.

Concerning Metaquote Server: they simply have the most satisfying price history of all the servers I tried. Also, switching back is not possible, if I'm right (except of course for a total re-install).


Clock

Clock
1183
Clock  

"Fine"!

So now that Version 842 is officially out, does the code still compile at anybodies else's PC?

For me, it's dead now, cause I cannot even go back to the last version.


Or: can anybody somehow provide me an earlier version?

Thanks in advance,

Clock

Alain Verleyen
Moderator
31182
Alain Verleyen  
Clock:

"Fine"!

So now that Version 842 is officially out, does the code still compile at anybodies else's PC?

For me, it's dead now, cause I cannot even go back to the last version.


Or: can anybody somehow provide me an earlier version?

Thanks in advance,

Clock

It's clearly a bug. The simple fact to declare a static variable in a class results in this error. Did you reported it to ServiceDesk ?
Clock
1183
Clock  
angevoyageur:
It's clearly a bug. The simple fact to declare a static variable in a class results in this error. Did you reported it to ServiceDesk ?
I did last week already.

My complain vanished from my profile within 2 days, so I thought they already recognized it.

Now, I reposted my complain.

Alain Verleyen
Moderator
31182
Alain Verleyen  
Clock:
I did last week already.

My complain vanished from my profile within 2 days, so I thought they already recognized it.

Now, I reposted my complain.

Your complain vanished ? All tickets are available in your profile, no need to repost.
12
To add comments, please log in or register