在Windows上编译Erlang代码 [英] Compiling Erlang code on Windows

查看:504
本文介绍了在Windows上编译Erlang代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了Erlang 13B并尝试按照教程。

I installed Erlang 13B and tried to follow the tutorials.

每次我到达 c(tut),我得到一个错误,而不是(ok,tut),所以似乎没有安装模块。任何人都可以指向正确的方向?

Every time I get to c(tut), I get an error instead of (ok, tut), so it seems like there are no modules installed. Can anyone point me in the right direction?

我尝试过Emacs,但我真的不知道如何使用它,甚至没有接近Erlang模式工作。例如,我在哪里键入:

I've tried Emacs but I don't really know how to use it and haven't even got close to getting the Erlang mode working. For instance, where do I type:

  (setq load-path (cons  "C:/Program Files/erl5.6.2/lib/tools-<ToolsVer>/emacs"
    load-path))
  (setq erlang-root-dir "C:/Program Files/erl5.6.2")
  (setq exec-path (cons "C:/Program Files/erl5.6.2/bin" exec-path))
  (require 'erlang-start)


推荐答案

对于 c(tut)工作,必须有 tut.erl 文件。

For c(tut) to work, there has to be a tut.erl file in the current directory.

如果您从命令行启动Erlang解释器,这是很容易实现的,这在Linux和OS X等系统上很常见,但这不是通常的模式在Windows上。当您从Windows开始菜单中的图标启动Erlang时,当前工作目录默认为 werl.exe 的位置,这不是您的 tut.erl 文件。

This is easy to accomplish if you start the Erlang interpreter from the command line, as is common on systems like Linux and OS X, but this isn't the usual pattern on Windows. When you start Erlang on Windows from the icon in the Start menu, the current working directory defaults to the location of werl.exe, which isn't where your tut.erl file is.

要使命令按预期工作,必须将工作目录更改为 tut.erl 后启动Erlang shell。如果 tut.erl 在桌面上,则在Vista或Windows 7上的命令将是这样:

To make your command work as expected, you have to change your working directory to be the location of tut.erl after starting the Erlang shell. If tut.erl is on the Desktop, the command will be something like this on Vista or Windows 7:

cd("c:/Users/myname/Desktop").

(是的,你必须使用正斜杠反斜杠在Erlang字符串中是特殊的。)

(Yes, you have to use forward slashes. Backslashes are special in Erlang strings.)

在Windows XP及更早版本中,您的桌面文件夹被埋得更深。将 werl.exe 放在系统 PATH 中可能更简单,并在这些系统上使用命令行。

On Windows XP and older, your Desktop folder is buried much deeper. It might be simpler to put werl.exe in the system PATH and use the command line on such systems.

这是没有必要的,但您可以考虑安装 Cygwin 。它的Bash shell将给你一个更多的Linux或OS X的环境,这将有助于你的工作与其他教程结构为这些操作系统。

It isn't necessary, but you might want to consider installing Cygwin. Its Bash shell will give you a more Linux or OS X like environment, which will help you work with other tutorials that are structured for those OSes.

这篇关于在Windows上编译Erlang代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆