---
title: "Generating included code - Developing programs - MetaEditor Help"
description: "MetaEditor provides the function for generating include files (*.mqh) from exported functions of the current file. It makes it... - Generating included code - Developing programs - MetaEditor Help"
image: "https://www.metatrader5.com/i/logo_metatrader5.png"
url: "https://www.metatrader5.com/en/metaeditor/help/development/generate_mqh"
---

[MetaEditor Help](https://www.metatrader5.com/en/metaeditor/help) → [Developing programs](https://www.metatrader5.com/en/metaeditor/help/development) → Generating included code

# Generating include files

MetaEditor provides the function for generating include files (*.mqh) from exported functions of the current file. It makes it easy to give other users access to your functions without disclosing their source code. To do this, simply provide a generated mqh file and a closed EX4/EX5 file where the functions are implemented.

## Generation process

Open an MQ4/MQ5 file and click ![Generate mqh file](https://www.metatrader5.com/i/help/metaeditor/en/generate_mqh_icon.png) Generate Include File in the [Tools](https://www.metatrader5.com/en/metaeditor/help/main_menu/main_menu_tools) menu. An mqh file is generated the following way:

- The current open file contains all functions with the [export](https://www.mql5.com/en/docs/basis/function/export) post-modifier.
- The include file with the [#import](https://www.mql5.com/en/docs/basis/preprosessor/import) directive and the description of detected functions is generated.
- If no export function found, an appropriate message is displayed.
- If a source file is located in the /Libraries folder, the module name in the #import directive has a relative path from the /Libraries directory. If a file is located in another directory, only a name of an EX4/EX5 file is substituted to #import.

> If the current file is an include one (*.mqh), generation command does not work.

## Generation path

The directory the mqh file is created in depends on the source file location:

- If the current file is located in the /Libraries directory or in one of its sub-directories, the include file is generated directly in the /Include folder.
- If a source file is located in some other directory, an include file is generated at the same location.

## In this section

- [Intelligent management](https://www.metatrader5.com/en/metaeditor/help/development/intelligent_management)
- [Find and replace](https://www.metatrader5.com/en/metaeditor/help/development/source_code_find)
- [Styler](https://www.metatrader5.com/en/metaeditor/help/development/styler)
- [Compilation](https://www.metatrader5.com/en/metaeditor/help/development/compile)
- [MQL5 Cloud Protector: Advanced protection for programs](https://www.metatrader5.com/en/metaeditor/help/development/mql5_cloud_protector)
- [Code debugging](https://www.metatrader5.com/en/metaeditor/help/development/debug)
- [Code profiling](https://www.metatrader5.com/en/metaeditor/help/development/profiling)
- [AI Assistant](https://www.metatrader5.com/en/metaeditor/help/development/ai_assistant)
- Generating included code
- [Working with C++ DLL (integration with MS Visual Studio)](https://www.metatrader5.com/en/metaeditor/help/development/c_dll)
- [Working with Python](https://www.metatrader5.com/en/metaeditor/help/development/python)
- [OpenCL support](https://www.metatrader5.com/en/metaeditor/help/development/opencl)

```json
{"@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [ {"@type": "ListItem", "position": 1, "item": {"@id": "https://www.metatrader5.com/en/metaeditor/help", "name": "MetaEditor Help"}}, {"@type": "ListItem", "position": 2, "item": {"@id": "https://www.metatrader5.com/en/metaeditor/help/development", "name": "Developing programs"}}, {"@type": "ListItem", "position": 3, "item": {"@id": "https://www.metatrader5.com/en/metaeditor/help/development/generate_mqh", "name": "Generating included code"}} ]}
{ "@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{ "@type": "Question", "name": "MetaTrader 5: Generating included code", "acceptedAnswer": { "@type": "Answer", "text": "MetaEditor provides the function for generating include files (*.mqh) from exported functions of the current file. It makes it easy to give other..." } }] }
```
