Unresolved Static Variable? - page 2

To add comments, please log in or register
Clock
1339
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):

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
Alain Verleyen
39043
Alain Verleyen  
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.
Mideel
90
Mideel  
Hello how about static array in a class ? no matter what I do there is still error...
Alain Verleyen
39043
Alain Verleyen  
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.
12
To add comments, please log in or register