LoginSignup
16
24

More than 1 year has passed since last update.

MQL4をVSCode(とMT4)でコンパイルする!

Last updated at Posted at 2018-04-15

やっとこさコンパイル出来るようになったので、メモ代わりに置いときます。
うまく行かなかったら、ごめんなさい。
MacOS(wine)とWindows両対応です。

以下のtasks.jsonを.vscodeのディレクトリに放り込んでください。
ビルド方法はMacOSならば「Shift+Command+B」でビルド出来ました。

2021/08/14 ログ表示機能を追加しました。
ターミナルにコンパイル結果ログを表示するようになりました。(Windowsのみ)
CTRLキーを押しながらエラー箇所をクリックすると該当箇所にジャンプしてくれる
みたいです。
※ちなみにエラーがない場合は、ログが表示されない仕様となっております。(なぜか。。)

tasks.json
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "MQL4-Compile",
      "presentation": 
      {
        "echo"  : true,
        "reveal": "always",
        "focus" : true,
        "panel" : "shared",
        "showReuseMessage": false,
      },
      "group": "build",
      "promptOnClose" : true,
      "type"          : "process",
      "osx" :
      { 
        "command" : "wine",
        "args"    : 
        [ 
          "/Users/hogehoge/.wine/drive_c/Program Files/OANDA - MetaTrader/metaeditor.exe",
          "/compile:${fileBasename}",
          "/log:${fileBasenameNoExtension}.log",
        ]
      },
      "windows" : 
      { 
         "command" : "C:\\Program Files (x86)\\OANDA - MetaTrader\\metaeditor.exe",
       "args" : 
        [ 
          ":/compile:${fileBasename}",
          "/log:${fileBasenameNoExtension}.log",
        ]
      },
    },
    {
      "label": "MQL4-Output",
      "type": "process",
      "presentation": 
      {
        "echo"  : true,
        "reveal": "always",
        "focus" : true,
        "panel" : "shared",
        "showReuseMessage": false,
      },
      "dependsOn" : "MQL4-Compile",
      "group":
      {
        "kind": "build",
        "isDefault": true,
      },
      "command": "more",
      "args": [ "${fileBasenameNoExtension}.log"],
    }
  ]
}
16
24
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
24