Errors, bugs, questions - page 1099

 
Error at compile time
class A {
public:
        A( int  ) { a = 2; }
        A( long ) { a = 3; }
        int a;
};

#define  F( f, cN )  \
template<typename T> \
cN *f( T t ) { return ( new cN( t ) ); }

F( a11, A )

and if not using a parametric macro, by manually substituting the parameters:

//F( a11, A )
template<typename T>
A *a11( T t ) { return ( new A( t ) ); }

void OnStart()
{
        int b = 10;
        A *a = a11( b );
        Print( a.a );
        delete( a );
}
then everything is fine
 

Unspeakably surprised... ME is completely unable to see variables declared in inludes in other project files on the main level (it doesn't highlight and can't jump to the variable definition).

How long has it been like this?

 
joo:

Unspeakably surprised... ME is completely unable to see variables declared in inludes in other project files on the main level (it doesn't highlight and can't jump to the variable definition).

How long has it been like this?

In each "inluder", you also need to specify other files to be linked to.
 
tol64:
In each "inluder", you must also specify other files to be linked to.

The project compiles just fine, which means that the compiler sees everything - what's where. The ME editor does not.

Besides, how do you imagine to specify the main executable .mq5 file as an inluder where the variable is declared?

 
joo:

The project compiles just fine, which means that the compiler sees everything - what's where. The ME editor doesn't.

Besides, how do you imagine specifying the main executable .mq5 file as an inline where the variable is declared?

For example, like this:

//--- Связь с основным файлом эксперта
#include "..\Main.mq5"
Or give a brief example, on which you can't do something. It will be faster. )
 
tol64:

For example, like this:

Or give a brief example, on which you can't do something. It will be faster. )
\Project\

Main.mq5

input string Nevidimka="труляля";

#include "Include\Incl.mqh"

\Project\Include\

Incl.mqh

void Func()
{
  Print(Nevidimka);//Тут переменная Nevidimka не подсвечивается как должна бы подсвечиваться и нельзя перейти к месту её объявления
}
 
joo:
...

Main file in the Project folder:

//+------------------------------------------------------------------+
//|                                                         Main.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
//---
#include "Include\Incl.mqh"
//---
input string Nevidimka="труляля";
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Deinitialization function of the expert                          |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  }
//+------------------------------------------------------------------+
//| OnTick                                                           |
//+------------------------------------------------------------------+
void OnTick()
  {
  }
//+------------------------------------------------------------------+

A plug-in file in the Project\Include directory:

//--- Связь с основным файлом эксперта
#include "..\Main.mq5"
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Func()
  {
   Print(Nevidimka); // Теперь подсвечивается и можно перейти к месту её объявления
  }
//+------------------------------------------------------------------+
 
tol64:

Main file in the Project folder:

A plug-in file in the Project\Include directory:

What's the point of this pointless gesture? ME must see (and programmer) variables and functions exactly as the compiler does.

Besides, what you propose in most cases is inconvenient (edit the inludes for each project?).

 

Each file's intellisense only works within its own scope. That is, the whole file is scanned with all its obvious inclusions.

You propose to show the data of some file without links to other unknown files. This is fundamentally wrong.

 
joo:
So what is this pointless gesture for? ME must see (and the programmer) variables and functions exactly as the compiler does.
I do not know of any other options. ) Maybe someone else can answer.