“** exception error:undefined function add:addfunc / 0 in Erlang” [英] "** exception error: undefined function add:addfunc/0 in Erlang "

查看:249
本文介绍了“** exception error:undefined function add:addfunc / 0 in Erlang”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行一个添加两个数字的简单的erlang程序。
我试图在Ubuntu 10.04 LTS中的Eclipse中执行此操作。

I'm trying to execute a simple erlang program of adding two numbers. I'm trying to do this in Eclipse on Ubuntu 10.04 LTS.

当我执行此程序时,我收到错误如下所示: / p>

When i execute this program, I'm getting the error as shown below:

** exception error: undefined function add:addfunc/0

我如何解决这个错误?感谢提前。

How do i go about solving this error? Thanks in advance.

这个程序在erlang shell中执行时工作正常。但是,当涉及到eclipse它给我这个错误。不是这样,任何程序都会给我类似的错误。猜猜我会丢失一些有关eclipse配置的东西。

This program when executed in the erlang shell is working fine. But when it comes to eclipse it's giving me this error. Not this, any program for that matter is giving me the similar error. Guess I would be missing something about the eclipse configuration.

编辑:

无论如何,这是示例添加程序,

Anyways, This is the sample add program,

-module(add). 
-export([addfunc/0]).

addfunc() -> 
    5 + 6.


推荐答案

您的模块 add 没有导出的函数 addfunc / 0
确保要调用的函数具有正确的名称,不要求任何
参数,
导出,模块是
编译,搜索路径包括编译梁文件,并且没有使用代码的模块冲突:clash()

This message tells you that module add doesn't have an exported function addfunc/0. Ensure the function you want to be called has exactly that name, doesn't expect any parameters, is exported, the module is compiled, the search path includes the compiled beam file and that there is no module clashes using code:clash()

更新

不清楚如何使用erlide(eclipse erlang插件,您似乎使用)编译并运行程序。尝试使用erlc或erl shell内部编译源代码。这样你就可以有更容易控制的环境,你会更好地了解发生了什么。

It's not clear how erlide (eclipse erlang plug-in you seem to use) compiles and runs a program. Try to compile source using erlc or inside erl shell. That way you'll have much easier controllable environment and you'll better understand what's going on.

这篇关于“** exception error:undefined function add:addfunc / 0 in Erlang”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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