我正在创建一个混合脚本,一切似乎都很好,但是我无法调用生成的脚本可执行文件。

>混合escript.build

lib/cmdlineutil.ex:2: warning: variable args is unused
Compiled lib/cmdlineutil.ex
Generated cmdlineutil.app
Consolidated Access
Consolidated Collectable
Consolidated Enumerable
Consolidated Inspect
Consolidated List.Chars
Consolidated Range.Iterator
Consolidated String.Chars
Consolidated protocols written to _build/dev/consolidated
Generated escript cmdlineutil with MIX_ENV=dev

> cmdlineutil



> MV cmdlineutil cmdlineutil.exe

> cmdlineutil.exe



留言框:



lib\cmdlineutil.ex:
defmodule CmdLineUtil.Echo do
    def main(args) do
        IO.puts "Hello!"
    end
end

mix.exs:
defmodule CmdLineUtil.Echo.Mixfile do
  use Mix.Project

  def project do
    [app: :cmdlineutil,
     version: "0.0.1",
     elixir: "~> 1.0.0",
     escript: escript,
     deps: deps]
  end

  def escript do
    [main_module: CmdLineUtil.Echo]
  end

  # Configuration for the OTP application
  #
  # Type `mix help compile.app` for more information
  def application do
    [applications: [:logger]]
  end

  # Dependencies can be Hex packages:
  #
  #   {:mydep, "~> 0.3.0"}
  #
  # Or git/path repositories:
  #
  #   {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
  #
  # Type `mix help deps` for more examples and options
  defp deps do
    []
  end
end

最佳答案

有一个与Erlang一起安装的escript命令。

关于windows - 如何在Windows 8.1上运行Elixir电子脚本,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26569257/

10-13 03:21