繁体   English   中英

Erlang 编译器找不到包含文件 test.hrl

[英]Erlang compiler cannot find include file test.hrl

我有一个项目,假设:

项目结构是 root/p1/mod1/include/test.hrl 和 root/p2/mod2/foo.erl 我在 root/p1/mod1/include 中有一个 erlang hrl 文件,我已经将它包含在 erlang 文件 (.erl) 中在 root/p2/mod2

当我编译文件 foo.erl 时,它给出以下错误:

foo.erl:16: can't find include file "test.hrl"

我尝试将它包含在 erlc 的 -I 标志中,如下所示:

user[root/p2/mod2]$ erlc foo.erl -I "/local/user/root/p1/mod1/include"
foo.erl:16: can't find include file "test.hrl"

但它似乎并没有解决它。 任何人都可以帮助解决它吗?

Erlang 中,命令应该在下面:

erlc 标志 file1.ext file2.ext...

编译一个或多个文件。 文件必须包含扩展名,例如,.erl 表示 Erlang 源代码,或 .yrl 表示 Yecc 源代码。 Erlc 使用扩展来调用正确的编译器

支持以下标志:

-我'目录'

所以只需在 erl 文件之前移动你的 -I :

erlc -I "/local/user/root/p1/mod1/include" foo.erl

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM