英文:
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'm trying to implement a GitHub action that compiles `.mq4` files. Currently, I'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'm having is that this script doesn't fail, but doesn'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'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'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>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论