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

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

问题描述

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



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



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

 (setq load-path(consC:/ Program Files / erl5.6.2 / lib / tools-< ToolsVer> / emacs
load-path))
(setq erlang-root-dirC:/ Program Files / erl5.6.2)
(setq exec -path(consC:/ Program Files / erl5.6.2 / binexec-path))
(require'erlang-start)


解决方案

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



为了使您的命令按预期工作,您必须将工作目录更改为启动Erlang shell后, tut.erl 如果 tut.erl 在桌面上,则Vista或Windows 7上的命令将如下所示:

  CD( C:/用户/ MYNAME /桌面)。 

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



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



没有必要,但您可能需要考虑安装 Cygwin 。它的Bash shell将为您提供更多的Linux或OS X环境,这将帮助您使用为这些操作系统构建的其他教程。


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

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?

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)

解决方案

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

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.

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").

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

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.

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天全站免登陆