Erlang应用程序问题
我尝试将应用程序编写到我的 Erlang 程序中。
我有 test_app.erl:
-module(test_app).
-behaviour(application).
%% Application callbacks
-export([start/2, stop/1]).
start(_Type, _StartArgs) ->
test_sup:start_link().
stop(_State) ->
ok.
和 .app 文件:
{application, test,
[{description, "test system."},
{vsn, "1.0"},
{modules, [test_app, test_sup, fsm]},
{registered, [test_sup, fsm]},
{applications, [kernel, stdlib]},
{mod, {test_app, []}}
]}.
当我尝试启动应用程序时:
application:start(test).
我收到错误:
=INFO REPORT==== 18-Feb-2011::19:38:53 ===
application: test
exited: {bad_return,
{{test_app,start,[normal,[]]},
{'EXIT',
{undef,
[{test_sup,start_link,[[]]},
{test_app,start,2},
{application_master,start_it_old,4}]}}}}
type: temporary
{error,{bad_return,{{test_app,start,[normal,[]]},
{'EXIT',{undef,[{test_sup,start_link,[[]]},
{test_app,start,2},
{application_master,start_it_old,4}]}}}}}
出了什么问题?我该如何修复它?
如果我在 eshell 中创建:
test_app:start(normal, []).
那么一切都有效。
谢谢。
I try to write application to my Erlang program.
I have test_app.erl:
-module(test_app).
-behaviour(application).
%% Application callbacks
-export([start/2, stop/1]).
start(_Type, _StartArgs) ->
test_sup:start_link().
stop(_State) ->
ok.
And .app file:
{application, test,
[{description, "test system."},
{vsn, "1.0"},
{modules, [test_app, test_sup, fsm]},
{registered, [test_sup, fsm]},
{applications, [kernel, stdlib]},
{mod, {test_app, []}}
]}.
When i try to start application:
application:start(test).
I get error:
=INFO REPORT==== 18-Feb-2011::19:38:53 ===
application: test
exited: {bad_return,
{{test_app,start,[normal,[]]},
{'EXIT',
{undef,
[{test_sup,start_link,[[]]},
{test_app,start,2},
{application_master,start_it_old,4}]}}}}
type: temporary
{error,{bad_return,{{test_app,start,[normal,[]]},
{'EXIT',{undef,[{test_sup,start_link,[[]]},
{test_app,start,2},
{application_master,start_it_old,4}]}}}}}
What's wrong? How can i fix it?
If i make in eshell:
test_app:start(normal, []).
Than all works.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想这可能是由于未加载 [proper] .beam 造成的。确保所有模块都位于同一目录中,或尝试使用
-pa
键erl(1)
,例如:I suppose this might be caused by not loading the [proper] .beam. Ensure that all modules are in the same directory, or try to use
-pa
key toerl(1)
, e. g.: