a.建立文件结构:
b.写代码:
%%暂时定义一个活动行为
%%每一个活动有5个行为:获取,开始,运行中,停止,停止中
-module(active_temp).
-callback get(atom(), integer(), term(), active:active()) -> tuple().
-callback start(atom(), term(), active:active(), integer()) -> 'ok'.
-callback run(atom(), term(), active:active(), integer()) -> 'ok'.
-callback close(atom(), term(), active:active(), integer()) -> 'ok'.
-callback shut(atom(), term(), active:active(), integer()) -> 'ok'.
-module(test_behaviour).-behaviour(active_temp).-export([get/4]).get(_Src, _RoleUid, _A, _Active) ->{}.
Unresolved behaviour active_temp less… (Ctrl+F1)
Checks that the behaviour exists and requires callback implementations
识别不了这个行为,更不要说约束了.
解决方法:将行为所在文件夹设置为lib库即可,步骤如下
如果设置成功了,game_lib的目录颜色将变成黄色,并且有个后缀:library root.再回去看,应该就没有开头那个不能识别的提示了,反而有可能变成缺少什么方法的警告了.
compile “plugin/game/src/test/l”plugin/game/src/test/l:3: Warning: behaviour active_temp undefined
这个是因为我们刚才告诉了idea行为定义在哪儿,但是现在erlang系统编译的时候找不到,所以还需要设置行为beam文件的位置:
ok,现在编译就能通过了.
本文发布于:2024-02-02 07:22:24,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170682974342245.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |