This happens because enum members share the same global namespace in MQL5.
Older builds allowed duplicates, but since build 5200 the compiler blocks them.
Solution: rename them with unique prefixes (e.g. SINO_NO, SC_NO) or wrap each enum in a namespace and qualify when using them.
Forum on trading, automated trading systems and testing trading strategies
New MetaTrader 5 Platform Build 5200: Extended OpenBLAS support and enhanced control in MQL5
MetaQuotes, 2025.07.31 14:57
MQL5: Identical identifiers are now prohibited across different enumerations. An identifier declared in one enumeration can no longer be reused in another within the same scope:enum A { Value }; enum B { Value // error, name 'Value' is already used in enumeration A }; void OnStart(void) { enum C { Value // OK, 'Value' is not used within the OnStart scope }; }
This happens because enum members share the same global namespace in MQL5.
Older builds allowed duplicates, but since build 5200 the compiler blocks them.
Solution: rename them with unique prefixes (e.g. SINO_NO, SC_NO) or wrap each enum in a namespace and qualify when using them.
Hello Miguel Angel. Thanks for your quick reply.
I'll have to rename a lot of definitions, but there is no any other alternative.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone. I need your help!
I can't compile my EAs after updating the compiler. My current version is 5.00, build 5200 (August 1, 2025), and I'm not sure when it started failing, but I can't compile any of my EAs, not even the ones already running in production without errors.
I'm now getting a lot of errors that I didn't see before.
For example, I'm now getting the error "identifier 'NO' already used," and the related code is:
enum sino { NO =0, SI =1 }; enum sinocontra { NO =0, SI =1, CONTRA=2 };I see I'm using the same identifier in two different enumeration declarations. Of course, this works in all the compiled versions I've published (over 200), but recently it started failing. What I would not want is to have to replace all the definitions with issues, everywhere along my code (7000+ lines)
Any thoughs are welcome.
Thanks in advance.