[英]Erlang compiler cannot find include file test.hrl
I am having a project where suppose:我有一个项目,假设:
Project structure is root/p1/mod1/include/test.hrl and root/p2/mod2/foo.erl I have a erlang hrl file in root/p1/mod1/include and i have included it in erlang file (.erl) in root/p2/mod2项目结构是 root/p1/mod1/include/test.hrl 和 root/p2/mod2/foo.erl 我在 root/p1/mod1/include 中有一个 erlang hrl 文件,我已经将它包含在 erlang 文件 (.erl) 中在 root/p2/mod2
When I am compiling file foo.erl it gives following error:当我编译文件 foo.erl 时,它给出以下错误:
foo.erl:16: can't find include file "test.hrl"
I tried including it in -I flag of erlc such as below:我尝试将它包含在 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"
But it does not seem to solve it.但它似乎并没有解决它。 Can anyone help on how to resolve it?任何人都可以帮助解决它吗?
In Erlang , the command should be below:在Erlang 中,命令应该在下面:
erlc flags file1.ext file2.ext... erlc 标志 file1.ext file2.ext...
Compiles one or more files.编译一个或多个文件。 The files must include the extension, for example, .erl for Erlang source code, or .yrl for Yecc source code.文件必须包含扩展名,例如,.erl 表示 Erlang 源代码,或 .yrl 表示 Yecc 源代码。 Erlc uses the extension to invoke the correct compiler Erlc 使用扩展来调用正确的编译器
The following flags are supported:支持以下标志:
-I 'Directory' -我'目录'
So just move your -I before erl file:所以只需在 erl 文件之前移动你的 -I :
erlc -I "/local/user/root/p1/mod1/include" foo.erl
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.