This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community

"expression on global scope not allowed" error at compile time


Back to topics list
avatar
4
bayesiantrader 2009.07.08 16:17 

About 1200 lines into my EA source, when compiling, I start to get multiple messages "blah..blah.. expression on global scope not allowed" on the

same global scope variable; using expressions like if( gbGlobal VAr ) that have passed compilation successfully in preceding function definitions.

This started to occur when I imported a user library in the program header... I saw a thread from 1/30/2006 by Michael Rennie on this same topic,

but have been unable to find the responses... Anyone got a fix? Suggestions as to how I have run amok?

avatar
4
bayesiantrader 2009.08.10 07:15 

Resolved this myself. A line of code similar to the following was to blame...

iVar = jVar; //*07312009 changed to use different var

The /* in the above comment was interpreted by the compiler as the beginning of a /* ... */ bracketed comments block. A later */ was picked up by the compiler, terminating the block, but the intervening code was ignored by the compiler. This anomaly was not visible in the MetaEditor (i.e the comment area that was

ignored was not changed in color), so it was not visible that this was what was going on in the MetaEditor.

Back to topics list  
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets