![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Expet:
Duck, you have a library. Of course, there will be different variables. What is meant is to connect mqh via include.
In C++, externs are just described in include libraries, otherwise the compiler won't let you compile the project
extern:
the includer will be inserted into the body of the program when you compile it. if you want to describe an instance there, the same thing will happen.
alternatively, you could describe an external class or structure with the modifier ;)
In C++, externs are described in include libraries, otherwise the compiler will not let you compile the project.
The usual way to call a library is to use "#include" as the name of the file
...
The point of this is that the includer will be inserted into the body of the program when compiling, if you want to describe an instance there, the same thing will happen.
The point is to allow the linkable file to be handled independently of the whole project, to compile it separately and thus check for errors.
The point is to be able to work on a plug-in file independently of the whole project, to compile it separately and thereby check for errors.
I think we're looking for the point where it just isn't there.
the extern was retained for compatibility with thousands of previously written code and the help was written by a guy who copied some of the information from the wiki.
I think we're looking for meaning where none exists.
imho, extern was retained for compatibility of thousands of codes written earlier, and the help was written by a person who copied some of the information from wiki
So what is the verdict of the Gentlemen?) If I write an .mq5 program with .mqh (#include), I can safely write extern and not be afraid of unexpected consequences (as I did in mql4) or use input ?
It depends on what purposes. They have different purposes.
So what's the verdict gentlemen)? If I'm writing an .mq5 program with .mqh (#include), I can safely write extern and not be afraid of unexpected consequences (as I did in mql4) or should I still use input ?
Use the standard MQL code constructs: all input at the beginning of the code, then all include. This is how the examples from the developers are written, and 99% of code in codobase are written this way, and you won't get any surprises.
Once again about extern - they can be changed during the execution of the program, but in my opinion it is bad practice, usually all external variables in OnInit () are copied into their variables and then work with them (as an example of experts that work for 4-character and 5-character - examples of this design in the network tons)
And the bottom line - do not use extern, if you modify old code, replace it with input and the compiler will help you with warnings if there was a record in extern - you must fix it
By the way, I discovered that the compiler does not care that I can re-declare the enum content as a variable
By the way, I found out that the compiler does not care that I can re-declare the enum content as a variable
what if I declare an enum variable?
implicit enum conversion tst1.mq5 24 17
you can also check EnumToString()
I think the type without declared variables was just thrown out of the compilation as not used