SymbolInfo.mqh causes errors when included

When I include symbolInfo.mqh, it causes errors (attached). Most of the errors says, “const modifier not allowed for nonmember functions”.

So far, I have the below:

#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\PositionInfo.mqh>
#include <Trade\AccountInfo.mqh>
CPositionInfo  m_position;                   // trade position object
CTrade         m_trade;                      // trading object
CSymbolInfo    m_symbol;                     // symbol info object

How do I make it a member? Thanks.

43

That code is right. It should compile right too. Can you show more ?

This is what you sent :

#include <WinUser32.mqh>
#include <mq4.mqh>
//#include <Trade/Trade.mqh>
//#include <Trade/SymbolInfo.mqh>
//#include <Trade/PositionInfo.mqh>
//#include <Trade/AccountInfo.mqh>
//CPositionInfo  m_position;                   // trade position object
//CTrade         m_trade;                      // trading object
//CSymbolInfo    m_symbol;                     // symbol info object

#import "wininet.dll"
   int InternetAttemptConnect(int a0);
   int InternetOpenW(string a0, int a1, string a2, string a3, int a4);
   int InternetOpenUrlW(int a0, string a1, string a2, int a3, int a4, int a5);
   int InternetReadFile(int a0, int& a1[], int a2, int& a3[]);
   int InternetCloseHandle(int a0);

#import "kernel32.dll"
   void GetLocalTime(int& a0[]);
   int  GetTimeZoneInformation(int& a0[]);
#import

This is what you asked if it works and it did :

#include <Trade/Trade.mqh>
#include <Trade/SymbolInfo.mqh>
#include <Trade/PositionInfo.mqh>
#include <Trade/AccountInfo.mqh>
CPositionInfo  m_position;                   // trade position object
CTrade         m_trade;                      // trading object
CSymbolInfo    m_symbol;                     // symbol info object

I suggest you to watch in <mq4.mqh> what’s happening.

Thanks for the guidance! I will do that.

That worked. There were things in mt4.mqh that was declaring the same as symbolinfo.mqh. Thank you for your help!