Unexpected token" error when declaring a struct using typedef

 

Hello I am getting this strange error for me when I define a struct like in the image using typedef.

Can anyone help me with what is the "unexpected token" erros and how to fix this ??!

Thanks a lot in advance.

Files:
MQL4.PNG  75 kb
 
younis_traveller: Hello I am getting this strange error for me when I define a struct like in the image using typedef. Can anyone help me with what is the "unexpected token" erros and how to fix this ??!

There is no need to use the "typedef". Just simply use the "struct" and simplify it!

struct TPSLprices { double SLprice, TPprice; };
 
when using 
typedef struct TPSLprices{  
   double SLprice;  
   double TPprice;
}TPSLprice;

it's still giving me the same error. 

'Unexpected Token' TPSLprice


And when I am  trying to declare the struct as you suggested then simplifying it as follows 

struct TPSLprices { double SLPrice, TPprice; };

typedef struct TPSLprices TPSLprice;

It gives the following error:

'TPSLprices' - identifier aready used
 
younis_travellerwhen using  it's still giving me the same error. And when I am  trying to declare the struct as you suggested then simplifying it as follows It gives the following error:

Why are your trying to define a new type?

Just use the the original structure type name in the rest of your code. I already stated, that there is no need to use "typedef" in this case.

This is not "C". This is MQL. It works a little differently!

EDIT: To make it more clear for you - you can't use "typedef struct" in MQL!

 
Don't use typedef; you can't even use typedef double Price. It is unimplemented except for pointer to a class method.
 
William Roeder:
Don't use typedef; you can't even use typedef double Price. It is unimplemented except for pointer to a class method.
More exactly pointer to a function, it doesn't work for a class method either.
 
Alain Verleyen:
More exactly pointer to a function, it doesn't work for a class method either.

In fact it's possible to assign a static class method to a suitable function pointer.

 
lippmaje:

In fact it's possible to assign a static class method to a suitable function pointer.

Didn't try that, thanks.
 
Thanks a lot for your comments. I removed the typedef and used the struct normally. 
Reason: