Unresolved Static Variable? - page 2

 

Now I got a reply from Service Desk, and it's working!

Here it goes:


----------------------------------------

Yes, now when you globally declare variables of a class or structure that have static members, you need to explicitly declare those members to tell compiler in which order variables should be initialized.

So, in your example, before the class declaration, add the following line where you can initialize the static variable with desired value (for example, 17.0):

double CMM::m_percent=17.0;

CMM      mms;
Documentation on MQL5: Language Basics / Object-Oriented Programming / Static Members of a Class
Documentation on MQL5: Language Basics / Object-Oriented Programming / Static Members of a Class
  • www.mql5.com
Language Basics / Object-Oriented Programming / Static Members of a Class - Documentation on MQL5
 
Clock:

Now I got a reply from Service Desk, and it's working!

Here it goes:


----------------------------------------

Yes, now when you globally declare variables of a class or structure that have static members, you need to explicitly declare those members to tell compiler in which order variables should be initialized.

So, in your example, before the class declaration, add the following line where you can initialize the static variable with desired value (for example, 17.0):

Ok, so it's a change in the compiler. A little weird in my opinion, anyway thanks for the information.
 
Hello how about static array in a class ? no matter what I do there is still error...
 
Mideel:
Hello how about static array in a class ? no matter what I do there is still error...
Please post your code if you need help.
 
Comments that do not relate to this topic, have been moved to "Off-topic posts".