Declaration of 'varaible 1' hides global variable (warning) Please help, cannot find the solution sine hours!

 
Hy guys, please help me the following issue. I researched for many hours already and cannot fix this issue.

mq4 file:


#include <TEST.mqh>

// Input parameters
input int variable1  = 10;

input double variable2 = 20;

No warning when I only compile the mq4 file(where I also use these variables) but when I include the TEST.mqh i get this Declaration of 'varaible 1' "variable2" hides global variable warning. 

TEST.mqh  code example

// -- Trade Logic -- 

ENUM_ORDER_TYPE GetTrade(int variable1, double variable2


I triple checked, there is no other declaration for these variables in another section of the code. 


Thank you very much for your support!

 
tradefy:
I triple checked, there is no other declaration for these variables in another section of the code. 

😄

tradefy:
mq4 file:


#include <TEST.mqh>

// Input parameters
input int variable1  = 10;

input double variable2 = 20;

No warning when I only compile the mq4 file(where I also use these variables) but when I include the TEST.mqh i get this Declaration of 'varaible 1' "variable2" hides global variable warning. 

TEST.mqh  code example

// -- Trade Logic -- 

ENUM_ORDER_TYPE GetTrade(int variable1, double variable2

 
input int variable1  = 10;
input double variable2 = 20;
⋮
ENUM_ORDER_TYPE GetTrade(int variable1, double variable2) 
  1. In your function, you have a local variable (first parameter) and a globally declared variable with the same name.
  2. If you intend to only use the global ones, remove the parameters from your function definition.
 
William Roeder #:
If you intend to only use the global ones, remove the parameters from your function definition.

In this case, TEST.mqh compilation errors will occur (when compiled separately from the mq4 file). I think it's better to just make the identifiers different

 
Vladislav Boyko #: TEST.mqh compilation errors will occur (when compiled separately from the mq4 file).

MQH indicates an include (header) file. You do not compile them, you include them.

 
William Roeder #:

MQH indicates an include (header) file. You do not compile them, you include them.

I always compile mqh files so that the compiler can check them. I believe that every header file should compile without errors and warnings regardless of the mq4/5 file.

That is, when I write another mqh file, I compile this mqh file to immediately check the just written code for errors without having to return to the mq4 file, which often I don’t even have open.

This is what the mq4 file of the expert I'm working on at the moment looks like:

I don't need this file 99.9% of development time (thanks to the fact that I compile mqh files for the compiler to check for errors😄)