编译MQL文件没有输出

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

Compiling MQL files produces no output

问题

  1. 我正在尝试实现一个GitHub操作,用于编译`.mq4`文件。目前,我有一个PowerShell脚本,根据[这里][1]描述的格式执行此操作:
  2. ```powershell
  3. $url = "http://www.rosasurfer.com/.mt4/{0}/metaeditor.exe" -f $Version
  4. $exePath = "metaeditor.exe"
  5. if ($verbose) {
  6. Write-Host "Attempting download from $($url)..."
  7. }
  8. try {
  9. Invoke-WebRequest -Uri $url -OutFile $exePath
  10. } catch {
  11. Write-Error "Failed to download MetaEditor from $($url), error: $($_.Exception.Message)"
  12. }
  13. Out-File -FilePath $LogFile
  14. $args = New-Object System.Collections.Generic.List[string]
  15. $args.Add("/portable")
  16. $args.Add('/compile:"{0}"' -f (Resolve-Path $Files))
  17. $args.Add('/inc:"{0}"' -f (Resolve-Path $Includes))
  18. $args.Add('/log:"{0}"' -f (Resolve-Path $LogFile))
  19. if ([System.Convert]::ToBoolean($SyntaxOnly)) {
  20. $args.Add("/s")
  21. }
  22. $exePath = Resolve-Path $exePath
  23. try {
  24. Start-Process $exePath -ArgumentList $args
  25. } catch {
  26. Write-Error "Compilation failed, error: $($_.Excaption.Message)"
  27. }
  28. gc $LogFile

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

  1. <details>
  2. <summary>英文:</summary>
  3. 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

  1. 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.
  2. [1]: https://stackoverflow.com/questions/14539064/how-to-compile-an-mql4-file-with-a-command-line-tool
  3. [2]: https://stackoverflow.com/questions/48494080/compiling-mql4-via-command-line-through-wine-metaeditor-exe
  4. </details>
  5. # 答案1
  6. **得分**: 0
  7. 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.
  8. <details>
  9. <summary>英文:</summary>
  10. 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.
  11. </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:

确定