编译MQL文件没有输出

huangapple go评论76阅读模式
英文:

Compiling MQL files produces no output

问题

我正在尝试实现一个GitHub操作,用于编译`.mq4`文件。目前,我有一个PowerShell脚本,根据[这里][1]描述的格式执行此操作:

```powershell
$url = "http://www.rosasurfer.com/.mt4/{0}/metaeditor.exe" -f $Version
$exePath = "metaeditor.exe"
if ($verbose) {
    Write-Host "Attempting download from $($url)..."
}

try {
    Invoke-WebRequest -Uri $url -OutFile $exePath
} catch {
    Write-Error "Failed to download MetaEditor from $($url), error: $($_.Exception.Message)"
}

Out-File -FilePath $LogFile

$args = New-Object System.Collections.Generic.List[string]
$args.Add("/portable")
$args.Add('/compile:"{0}"' -f (Resolve-Path $Files))
$args.Add('/inc:"{0}"' -f (Resolve-Path $Includes))
$args.Add('/log:"{0}"' -f (Resolve-Path $LogFile))
if ([System.Convert]::ToBoolean($SyntaxOnly)) {
    $args.Add("/s")
}

$exePath = Resolve-Path $exePath
try {
    Start-Process $exePath -ArgumentList $args
} catch {
    Write-Error "Compilation failed, error: $($_.Excaption.Message)"
}

gc $LogFile

我遇到的问题是,这个脚本没有失败,但也没有生成.ex4文件。日志文件也是空的。我尝试使用完全限定的路径到metaeditor实例,输入文件,包含目录和日志文件,正如这里建议的那样,但我仍然什么都得不到。


<details>
<summary>英文:</summary>

I&#39;m trying to implement a GitHub action that compiles `.mq4` files. Currently, I&#39;ve got a Powershell script that does that, according to the format described [here][1]:

$url = "http://www.rosasurfer.com/.mt4/{0}/metaeditor.exe" -f $Version
$exePath = "metaeditor.exe"
if ($verbose) {
Write-Host "Attempting download from $($url)..."
}

try {
Invoke-WebRequest -Uri $url -OutFile $exePath
} catch {
Write-Error "Failed to download MetaEditor from $($url), error: $($_.Exception.Message)"
}

Out-File -FilePath $LogFile

$args = New-Object System.Collections.Generic.List[string]
$args.Add("/portable")
$args.Add('/compile:"{0}"' -f (Resolve-Path $Files))
$args.Add('/inc:"{0}"' -f (Resolve-Path $Includes))
$args.Add('/log:"{0}"' -f (Resolve-Path $LogFile))
if ([System.Convert]::ToBoolean($SyntaxOnly)) {
$args.Add("/s")
}

$exePath = Resolve-Path $exePath
try {
Start-Process $exePath -ArgumentList $args
} catch {
Write-Error "Compilation failed, error: $($_.Excaption.Message)"
}

gc $LogFile


The issue I&#39;m having is that this script doesn&#39;t fail, but doesn&#39;t produce an `.ex4` files either. The log file is also empty. I tried using fully-qualified paths to the instance of `metaeditor`, the input files, include directory and log file as was suggested [here][2], but I&#39;m still not getting anything.


  [1]: https://stackoverflow.com/questions/14539064/how-to-compile-an-mql4-file-with-a-command-line-tool
  [2]: https://stackoverflow.com/questions/48494080/compiling-mql4-via-command-line-through-wine-metaeditor-exe

</details>


# 答案1
**得分**: 0

So, it turns out this was an artifact of the version of MetaEditor I was using. I'm not sure why, but version 4.1370.0 wasn't producing any output. Changing the version to the most recent one, fixed the issue and I can now compile my `.mq4` and `.mqh` files.

<details>
<summary>英文:</summary>

So, it turns out this was an artifact of the version of MetaEditor I was using. I&#39;m not sure why, but version 4.1370.0 wasn&#39;t producing any output. Changing the version to the most recent one, fixed the issue and I can now compile my `.mq4` and `.mqh` files.

</details>



huangapple
  • 本文由 发表于 2023年3月7日 15:24:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/75659026.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定