Global object descriptor does not compile

 

Hi, I´m writing my first Expert Advisor and I have a Problem I can´t solve. My Code looks like this:

#include <Arrays\ArrayDouble.mqh>
CArrayDouble *test;                     //This for example does work

#include "Class1.mq5"   //Contains class MyTrade
MyTrade *example;                       //This however doesn´t

int OnInit(){
        example = new MyTrade();
        //More initialization steps
}

void OnTick(){
        //Work with example
}

void OnDeinit(const int reason){
        delete(example);
}

The compiler errors are:

'MyTrade' - identifier already used

       see declaration of class 'MyTrade'

'*' - semicolon expected


Does anybody know how to fix this?

 
Christoph Hofbauer: 'MyTrade' - identifier already used

Double click on this to find out where the identifier is being reused.

Christoph Hofbauer: see declaration of class 'MyTrade'

Double click on this to see the first (previous) identifier declaration

 
Vladislav Boyko #:

Double click on this to find out where the identifier is being reused.

Double click on this to see the first (previous) identifier declaration

Thanks for answering, but thats exactly the problem.

The first declaration is the class itself (class MyTrade{...}) and its supposedly reused in line 5.

I think the compiler thinks I want to create a new struct or something like that, but I just want to initialize a global instance of my class MyTrade.

 
Christoph Hofbauer #:

Thanks for answering, but thats exactly the problem.

The first declaration is the class itself (class MyTrade{...}) and its supposedly reused in line 5.

I think the compiler thinks I want to create a new struct or something like that, but I just want to initialize a global instance of my class MyTrade.

Please attach a short code that will allow other users to reproduce your issue.

 
Vladislav Boyko #:

Please attach a short code that will allow other users to reproduce your issue.

I just found out that I forgot the semicolon at the End of MyTrade class, because I ran into more issues.
//I wrote this:
class MyTrade{
        //...
}

//instead of:
class MyTrade{
        //...
};

The compiler just never complained about it and now everything works.

Thanks for trying to help