
预处理程序是MQL编译器的一个子系统,通过预处理程序可以使软件的可读性更好,预处理程序运行在程序编译以前。预处理指令以(#)开头。
1 定义常量运用#define来定义常量。如:1. #define ABC 1002. #define PI 0.3143. #define COMPANY_NAME "MetaQuotes Software Corp."4. void ShowCopyright()5. {6. Print(ABC);7. Print(COMPANY_NAME);8. }程序在编译以前会被编译器先改成:1. void ShowCopyright()2. {3. Print(100);4. Print("MetaQuotes Software Corp.");5. }所以定义的常量在编译以前有种被替换的感觉。2 引入文件。运用#include命令来引入一个文件或dll。