Skip to content
ModernUI A DaneTrades developer library

Common Compile Errors

This page covers common MetaEditor compile problems.

Always start by confirming the install path:

Reference excerpt
MQL5/Include/ModernUI/ModernUI.mqh

Your EA should include:

Reference excerpt
#include <ModernUI\ModernUI.mqh>

Cannot open include file

Example message

Reference excerpt
cannot open include file 'ModernUI\ModernUI.mqh'

Most likely cause

ModernUI is not installed where MetaEditor expects it.

Fix

Copy the Include/ModernUI/ folder into:

Reference excerpt
MQL5/Include/ModernUI/

Then restart MetaEditor.

Also check

  • The folder is not nested as MQL5/Include/ModernUI/Include/ModernUI/.
  • The folder name is ModernUI, not Modern UI.
  • The file exists at MQL5/Include/ModernUI/ModernUI.mqh.
  • You are editing the correct MT5 terminal data folder.

Undeclared identifier: MuiRoot, Mui::AppWindow, or another ModernUI type

Most likely causes

  • Missing include.
  • Include path is wrong.
  • MetaEditor did not refresh after copying files.
  • You copied only some files instead of the full Include/ModernUI tree.
  • The docs reference a wrapper not present in your installed version.

Fix

Use the umbrella include:

Reference excerpt
#include <ModernUI\ModernUI.mqh>

Confirm the full Include/ModernUI/ tree is installed.

Restart MetaEditor and compile again.

Wrong parameters count

Most likely causes

  • The function signature changed between docs/package versions.
  • The arguments are in the wrong order.
  • You are mixing raw control factories with labelled wrapper signatures.
  • You omitted an array setup before calling a helper that expects string &items[].

Example

Raw SpinEdit and labelled LabeledSpinEdit are not the same shape.

Reference excerpt
Mui::SpinEdit(parent,min,max,initial,step,digits,handler,width,height);
Mui::LabeledSpinEdit(parent,label,min,max,step,value,digits,width,height,hint);

Fix

Check the exact page for the helper you are using:

Handler method does not override anything

Most likely cause

The handler method signature is wrong.

For button click handlers, use:

Handler class
class SaveHandler : public MuiClickHandler
{
public:
  virtual void OnChanged(MuiRoot &root,MuiEvent &e)
  {
    Mui::ToastSuccess(root,"Saved");
  }
};

Do not use older or guessed signatures unless the specific control header uses them.

Error caused by using input as a struct field or variable name

Most likely cause

input is reserved in MQL5.

ModernUI labelled wrapper structs use:

Reference excerpt
control

not:

Reference excerpt
input

Example:

Correct
MuiLabeledSpinEdit risk=Mui::LabeledSpinEdit(section.body,"Risk %",0.1,10.0,0.1,1.0);

if(risk.control!=NULL)
  risk.control.Value(2.0);

Array initialisation errors

MQL5 arrays often need explicit sizing.

Instead of relying on shorthand initialisers, use:

Correct
string actions[];
ArrayResize(actions,3);
actions[0]="Save";
actions[1]="Reset";
actions[2]="Close";

MuiButtonRow row=Mui::ButtonRow(parent,actions,0.0,0.0,true);

This is the safest style for docs and buyer examples.

Pointer access errors

If a helper returns a pointer, use pointer syntax.

Correct
MuiButtonAction *button=Mui::Button(parent,"Save",NULL,160.0,0.0);

if(button!=NULL)
  button.Text("Save settings");

If a wrapper returns a struct, access its fields first.

Correct
MuiLabeledSpinEdit risk=Mui::LabeledSpinEdit(parent,"Risk %",0.1,10.0,0.1,1.0);

if(risk.control!=NULL)
  risk.control.Value(2.0);

Example file cannot find ModernUI

If a supplied example fails to compile with an include error, the include folder is not installed in the terminal data folder used by that MetaEditor instance.

Use MetaTrader:

Menu path
File → Open Data Folder

Then copy ModernUI to:

Folder path
MQL5/Include/ModernUI/

Restart MetaEditor after copying.

Still failing?

Create a minimal file using the quick-start skeleton and compile that first.

Then add one control at a time.

If you open a support request, include:

  • exact compile error text
  • file name
  • ModernUI version
  • MT5 build number
  • whether a supplied example compiles
  • the smallest code snippet that reproduces the error

See Reporting a bug.